Description Usage Arguments Example application See Also Examples
Modals are a flexible alert window, which disable interaction with the page
behind them. Modals may include inputs, buttons, or simply text. Each modal
may be assigned an id
. By default hideModal()
will hide all modals, but
you may instead specify a modal's id
in which case only that modal is
closed. Additionally, when id
is not NULL
observers and reactives may
watch for the modal's close event.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
id |
A character string specifying the id of the modal, when closed
|
... |
Unnamed values passed as tag elements to the body of the modal. or named values passed as HTML attributes to the body element of the modal. |
header |
A character string or tag element specifying the header of the modal. |
footer |
A character string or tag element specifying the footer of the modal. |
center |
One of |
size |
One of |
fade |
One of |
modal |
A modal tag element created using |
session |
A reactive context, defaults to |
ui <- container( buttonInput( id = "open", "Open modal", icon("plus") ) ) server <- function(input, output) { modal1 <- modal( title = "A simple modal", p( "Cras mattis consectetur purus sit amet fermentum.", "Cras justo odio, dapibus ac facilisis in, egestas", "eget quam. Morbi leo risus, porta ac consectetur", "ac, vestibulum at eros." ) ) observeEvent(input$open, ignoreInit = TRUE, { showModal(modal1) }) } shinyApp(ui, server)
Other components:
alert()
,
badge()
,
blockquote()
,
card()
,
collapsePane()
,
d1()
,
dropdown()
,
img()
,
jumbotron()
,
navContent()
,
popover()
,
pre()
,
toast()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ### Simple modal
modal(
id = "simple",
header = h5("Title"),
p("Cras placerat accumsan nulla.")
)
### Modal with container body
modal(
id = "more_complex",
size = "lg",
header = h5("More complex"),
container(
columns(
column("Cras placerat accumsan nulla."),
column("Curabitur lacinia pulvinar nibh."),
column(
"Aliquam posuere.",
"Praesent fermentum tempor tellus."
)
)
)
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.