Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

bs_vars_modal

Bootstrap modal variables


Description

Those variables can be used to customize modal (e.g. shiny::modalDialog in Bootstrap and Bootswatch themes.

Usage

bs_vars_modal(
  md = NULL,
  lg = NULL,
  sm = NULL,
  inner_padding = NULL,
  title_padding = NULL,
  title_line_height = NULL,
  content_bg = NULL,
  content_border_color = NULL,
  content_fallback_border_color = NULL,
  backdrop_bg = NULL,
  backdrop_opacity = NULL,
  header_border_color = NULL,
  footer_border_color = NULL
)

Arguments

md

Size in pixel for medium modal, e.g. modalDialog(size = "m").

lg

Size in pixel for large modal, e.g. modalDialog(size = "l").

sm

Size in pixel for small modal, e.g. modalDialog(size = "s").

inner_padding

Padding applied to the modal body.

title_padding

Padding applied to the modal title.

title_line_height

Modal title line-height.

content_bg

Background color of modal content area.

content_border_color

Modal content border color.

content_fallback_border_color

Modal content border color (for IE8).

backdrop_bg

Modal backdrop background color.

backdrop_opacity

Modal backdrop opacity.

header_border_color

Modal header border color.

footer_border_color

Modal footer border color.

Value

a list that can be used in create_theme.

Examples

bs_vars_modal(
  md = "80%",
  backdrop_opacity = 1,
  header_border_color = "#112446",
  footer_border_color = "#112446"
)

if (interactive()) {
  library(shiny)
  library(shinyWidgets)

  ui <- fluidPage(
    use_theme(
      create_theme(
        theme = "default",
        bs_vars_modal(
          md = "80%",
          backdrop_opacity = 1,
          header_border_color = "#112446",
          footer_border_color = "#112446"
        ),
        output_file = NULL
      )
    ),
    tags$h1("Custom modals"),
    actionButton("show", "Show modal dialog")
  )

  server <- function(input, output, session) {

    observeEvent(input$show, {
      showModal(modalDialog(
        title = "Important message",
        "This is an important message!"
      ))
    })

  }

  shinyApp(ui, server)
}

fresh

Create Custom 'Bootstrap' Themes to Use in 'Shiny'

v0.2.0
GPL-3
Authors
Victor Perrier [aut, cre, cph], Fanny Meyer [aut], Thomas Park [ctb, cph] (Bootswatch themes), Mark Otto [ctb] (Bootstrap library), Jacob Thornton [ctb] (Bootstrap library), Bootstrap contributors [ctb] (Bootstrap library), Twitter, Inc [cph] (Bootstrap library), onkbear [ctb, cph] (admin-lte-2-sass), Colorlib [ctb, cph] (AdminLTE)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.