Skip to contents

Closes the overlay; if it was shown with transient = TRUE (the default), closing is also what removes it from the document, so this is all you need. For a transient = FALSE overlay this only closes it – it stays available for shad_dialog_open().

Usage

shad_remove_dialog(id, session = shiny::getDefaultReactiveDomain())

Arguments

id

The overlay's input id (namespaced automatically).

session

The Shiny session.

Value

Invisibly NULL; called for its side effect.

Details

Overlays close themselves on Esc, on a backdrop press, and via shad_dialog_close_button(), so calling this is only necessary when the server decides to dismiss one (a completed job, a timeout, a successful save).

Examples

if (interactive()) {
  ui <- page_shad(shad_button("Save", inputId = "save"))
  server <- function(input, output, session) {
    shiny::observeEvent(input$save, {
      shad_show_dialog(shad_dialog(
        "saved", title = "Saved", "Your changes were saved.",
        footer = shad_button("Done", inputId = "done")
      ))
    })
    shiny::observeEvent(input$done, shad_remove_dialog("saved"))
  }
  shiny::shinyApp(ui, server)
}