modal | R Documentation |
Create a modal in the UI.
The modal is not down see modal_show()
, or
modal_toggle()
(from server).
modal( id, ..., static_backdrop = FALSE, scrollable = FALSE, centered = FALSE, size = c("default", "sm", "lg", "xl", "fullscreen", "fullscreen-sm-down", "fullscreen-md-down", "fullscreen-lg-down", "fullscreen-xl-down", "fullscreen-xxl-down") )
id |
ID of modal. |
... |
Content of the modal, |
static_backdrop |
When backdrop is set to static, the modal will not close when clicking outside it. |
scrollable |
Whether to make the content scrollable. |
centered |
Whether to make the content vertically centered. |
size |
Size of the modal. |
library(shiny) ui <- fluidPage( theme = bslib::bs_theme(version = 5L), actionButton("show", "Show modal"), modal( id = "modal", modalHeader( modalTitle("Title") ), modalBody( p("The content of the modal") ), modalFooter( p("The footer of the modal") ) ) ) server <- \(input, output, session){ observeEvent(input$show, { modal_show("modal") }) } if(interactive()) shinyApp(ui, server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.