Dialog {shiny.blueprint}R Documentation

Dialog

Description

Documentation: https://blueprintjs.com/docs/#core/components/dialog.dialog

Usage

Dialog(...)

Arguments

...

Component props and children. See the official Blueprint docs for details.

Value

Object with shiny.tag class suitable for use in the UI of a Shiny app.

Examples

library(shiny.blueprint)
library(shiny)

ui <- function(id) {
  ns <- NS(id)
  tagList(
    Button.shinyInput(
      inputId = ns("showDialog"),
      "Show dialog"
    ),
    reactOutput(ns("dialog"))
  )
}

server <- function(id) {
  moduleServer(id, function(input, output, session) {
    ns <- session$ns

    isOpen <- reactiveVal(FALSE)
    observeEvent(input$showDialog, isOpen(TRUE))
    observeEvent(input$closeDialog, isOpen(FALSE))

    output$dialog <- renderReact({
      Dialog(
        usePortal = FALSE,
        isOpen = isOpen(),
        onClose = triggerEvent(ns("closeDialog")),
        div(
          className = "bp5-dialog-body",
          H5("Analytical applications"),
          tags$p(
            "User interfaces that enable people to interact smoothly with data,",
            " ask better questions, and make better decisions."
          ),
          Button.shinyInput(
            inputId = ns("closeDialog"),
            "Close"
          )
        )
      )
    })
  })
}

if (interactive()) shinyApp(ui("app"), function(input, output) server("app"))

[Package shiny.blueprint version 0.3.0 Index]