Description Usage Arguments Examples
Wired Dialog (Modal)
1 2 3 4 5 6 7 | wired_dialog(..., labelClose = "Close", width = "500px", id = NULL)
show_wired_dialog(ui, session = shiny::getDefaultReactiveDomain())
open_wired_dialog(id, session = shiny::getDefaultReactiveDomain())
close_wired_dialog(id, session = shiny::getDefaultReactiveDomain())
|
... |
Content of the modal window. |
labelClose |
Label for close button. |
width |
Width of the dialog. |
id |
Id for the dialog, can be useful to open/close dialog from server. |
ui |
Result of |
session |
Shiny session. |
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | if (interactive()) {
library(shiny)
library(wired)
ui <- fluidPage(
tags$h2("Wired modal"),
wired_button("show", "Show modal window"),
wired_dialog(
tags$div(
style = "position: absolute; top: 5px; right: 5px;",
wired_icon_button("close2", icon("times"))
),
plotOutput("plot"),
wired_slider("slider", "Value:"),
id = "mydialog", labelClose = NULL
),
wired_button("show2", "Show second modal window"),
)
server <- function(input, output, session) {
observeEvent(input$show, {
wired:::show_wired_dialog(
wired:::wired_dialog(
tags$h3("Here's a modal!"),
tags$p(
"Lorem ipsum dolor sit amet,",
"consectetur adipiscing elit",
"sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"Ut enim ad minim veniam,",
"quis nostrud exercitation ullamco laboris nisi ut aliquip,",
" ex ea commodo consequat.",
"Duis aute irure dolor in reprehenderit in voluptate velit,",
" esse cillum dolore eu fugiat nulla pariatur."
)
)
)
})
observeEvent(input$show2, {
open_wired_dialog("mydialog")
})
observeEvent(input$close2, {
close_wired_dialog("mydialog")
})
output$plot <- renderPlot({
plot(density(rnorm(input$slider)))
})
}
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.