Learn R Programming

nextGenShinyApps (version 2.1)

modalDialog: 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
)

Value

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

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

Examples

Run this code
# \donttest{
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",
        ))
      })
    }
  )
}
# }

Run the code above in your browser using DataLab