This module consists of a button that once clicked pops up a modal window with verbatim-styled text.
verbatim_popup_ui(id, button_label, type = c("button", "link"), ...)
verbatim_popup_srv(
id,
verbatim_content,
title,
style = FALSE,
disabled = shiny::reactiveVal(FALSE)
)(character(1)) the shiny id
(character(1)) the text printed on the button
(character(1)) specifying whether to use [shiny::actionButton()] or [shiny::actionLink()].
additional arguments to [shiny::actionButton()](or [shiny::actionLink()]).
(character, expression, condition or reactive(1)
holding any of the above) the content to show in the popup modal window
(character(1)) the title of the modal window
(logical(1)) whether to style the verbatim_content using styler::style_text.
If verbatim_content is a condition or reactive holding condition then this argument is ignored
(reactive(1)) the shiny reactive value holding a logical. The popup button is disabled
when the flag is TRUE and enabled otherwise.
the UI function returns a shiny.tag.list object
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)