bs_vars_modal: Bootstrap CSS modal variables

Description Usage Arguments Value Examples

View source: R/vars-bootstrap.R

Description

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

Usage

1
2
3
4
5
6
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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 documentation built on Oct. 30, 2019, 11:38 a.m.