A shiny module that pops up verbatim text.
verbatim_popup.Rd
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, ...)
verbatim_popup_srv(
id,
verbatim_content,
title,
style = FALSE,
disabled = shiny::reactiveVal(FALSE)
)Arguments
- id
(
character(1)) theshinyid- button_label
(
character(1)) the text printed on the button- ...
additional arguments to
[shiny::actionButton()]- verbatim_content
(
character,expression,conditionorreactive(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_contentusingstyler::style_text. Ifverbatim_contentis aconditionorreactiveholdingconditionthen this argument is ignored- disabled
(
reactive(1)) theshinyreactive value holding alogical. The popup button is disabled when the flag isTRUEand 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)