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)) theshinyid(
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,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
library(shiny)
ui <- bslib::page_fluid(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()) shinyApp(ui, srv)