This module consists of a button that once clicked pops up a modal window with verbatim-styled text.
Usage
verbatim_popup_ui(id, button_label, type = c("button", "link"), ...)
verbatim_popup_srv(
id,
verbatim_content,
title,
style = FALSE,
disabled = shiny::reactiveVal(FALSE)
)
Arguments
- id
(
character(1)
) theshiny
id- button_label
(
character(1)
) the text printed on the button- type
(
character(1)
) specifying whether to use[shiny::actionButton()]
or[shiny::actionLink()]
.- ...
additional arguments to
[shiny::actionButton()]
(or[shiny::actionLink()]
).- verbatim_content
(
character
,expression
,condition
orreactive(1)
holding any of the above) the content to show in the popup modal window- title
(
character(1)
) the title of the modal window- style
(
logical(1)
) whether to style theverbatim_content
usingstyler::style_text
. Ifverbatim_content
is acondition
orreactive
holdingcondition
then this argument is ignored- disabled
(
reactive(1)
) theshiny
reactive value holding alogical
. The popup button is disabled when the flag isTRUE
and enabled otherwise.
Examples
ui <- shiny::fluidPage(verbatim_popup_ui("my_id", button_label = "Open popup"))
srv <- function(input, output) {
verbatim_popup_srv(
"my_id",
"if (TRUE) { print('Popups are the best') }",
title = "My custom title",
style = TRUE
)
}
if (interactive()) shiny::shinyApp(ui, srv)