modalDialog: Generate a modal box

View source: R/modal.R

modalDialogR Documentation

Generate a modal box

Description

Advanced modal dialog that allows various positioning and transparency

Usage

modalDialog(
  ...,
  title = NULL,
  footer = modalButton("Dismiss"),
  size = c("m", "s", "l", "xl"),
  easyClose = FALSE,
  fade = TRUE,
  position = c("centered", "left", "right", "top", "bottom"),
  transparent = FALSE
)

Arguments

...

The elements to include within the body of the modal

title

The text to display in the header title

footer

Footer list of buttons or text

size

The size of the modal, "m", "s", "l", "xl"

easyClose

Allow simple closing, FALSE or TRUE

fade

Allow fading away or fadin in, FALSE or TRUE

position

Set the position of the modal. Choices include "centered","left","right","top","bottom"

transparent

Allow background transparency, FALSE or TRUE

Value

An HTML containing elements of a modal box that remains hidden until a button is clicked

Note

For more information on the features of the card, visit the examples section of the help documentation

Examples


if (interactive()) {
  library(shiny)
  library(nextGenShinyApps)
  shiny::shinyApp(
    ui = fluidPage(
      style = "8",
      custom.bg.color = "white",
      sidebar = NULL,
      header = NULL,
      shiny::h3("Modal EXAMPLES"),
      shiny::div(actionButton("obianom1", "Show BIG shiny modal on the RIGHT")),
      shiny::br(),
      shiny::div(actionButton("obianom2", "Show SMALL shiny modal on the RIGHT"))
    ),
    server = function(input, output) {
      shiny::observeEvent(input$obianom1, {
        shiny::showModal(modalDialog(
          textInput("dataset", "Enter a data set"),
          shiny::div("Id leo in vitae"),
          size = "l",
          position = "bottom",
        ))
      })
      shiny::observeEvent(input$obianom2, {
        shiny::showModal(modalDialog(
          textInput("dataset", "Enter a data set"),
          shiny::div("Lorem donec massa"),
          size = "l",
          position = "right",
        ))
      })
    }
  )
}


nextGenShinyApps documentation built on Nov. 12, 2023, 5:06 p.m.