Description Usage Arguments Examples
An alternative modal window. Load dependencies in
UI with load_tingle
, use tingle_*
in server.
1 2 3 4 5 6 7 8 9 10 | load_tingle()
tingle_show(ui, close_id = NULL, session = getDefaultReactiveDomain())
tingle_dialog(..., footer = tingle_button(), easy_close = TRUE,
sticky_footer = FALSE, css_class = NULL)
tingle_button(label = "Close", status = "default", pull_right = TRUE)
tingle_remove(session = getDefaultReactiveDomain())
|
ui |
Content of the modal defined with |
close_id |
Optionnal |
session |
The |
... |
UI elements for the body of the modal dialog box. |
footer |
UI for footer. Use NULL for no footer. |
easy_close |
If |
sticky_footer |
Set to |
css_class |
Custom CSS classes that will be added to tingle container. |
label |
The contents of the button or linkâusually a text label, but you could also use any other HTML, like an image. |
status |
Status for the button: |
pull_right |
Align the button on the right. |
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 55 | if (interactive()) {
library(shiny)
library(shinytools)
ui <- fluidPage(
load_tingle(),
tags$h1("Examples tingle modal"),
actionButton(inputId = "launch1", label = "Open modal"),
actionButton(inputId = "launch2", label = "Another one")
)
server <- function(input, output, session) {
output$plot <- renderPlot({
req(input$n)
hist(rnorm(input$n))
})
observeEvent(input$launch1, {
tingle_show(tingle_dialog(
tags$h2("Yes! A modal!"),
plotOutput(outputId = "plot"),
sliderInput(
inputId = "n", label = "Number of observations",
min = 10, max = 200, value = 20, width = "100%"
)
))
})
observeEvent(input$launch2, {
tingle_show(tingle_dialog(
tags$h2("Very important!"),
tags$p("Do you like Shiny?"),
footer = tagList(
actionButton("ofcourse", "Of course!", width = "49%"),
actionButton("yes", "Yes!", width = "49%")
),
easy_close = FALSE
))
})
observe({
input$ofcourse
input$yes
tingle_remove()
})
}
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.