bs4DashPage: Create a Boostrap 4 dashboard page

Description Usage Arguments Author(s) Examples

View source: R/dashboardPage.R

Description

Build an adminLTE3 dashboard page

Usage

 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
bs4DashPage(
  navbar = NULL,
  sidebar = NULL,
  body = NULL,
  controlbar = NULL,
  footer = NULL,
  title = NULL,
  old_school = FALSE,
  sidebar_mini = TRUE,
  sidebar_collapsed = FALSE,
  controlbar_collapsed = TRUE,
  controlbar_overlay = TRUE,
  enable_preloader = FALSE,
  loading_duration = 2,
  loading_background = "#1E90FF"
)

dashboardPage(
  navbar = NULL,
  sidebar = NULL,
  body = NULL,
  controlbar = NULL,
  footer = NULL,
  title = NULL,
  old_school = FALSE,
  sidebar_mini = TRUE,
  sidebar_collapsed = FALSE,
  controlbar_collapsed = TRUE,
  controlbar_overlay = TRUE,
  enable_preloader = FALSE,
  loading_duration = 2,
  loading_background = "#1E90FF"
)

Arguments

navbar

Slot for bs4DashNavbar.

sidebar

Slot for bs4DashSidebar.

body

Slot for bs4DashBody.

controlbar

Slot for bs4DashControlbar (right side).

footer

Slot for bs4DashFooter.

title

App title.

old_school

Whether to use the wonderful sketchy design for Bootstrap 4. FALSE by default.

sidebar_mini

Whether to see sidebar icons when bs4DashSidebar. is collapsed. TRUE by default.

sidebar_collapsed

Whether the sidebar is collapsed of not at start. FALSE by default.

controlbar_collapsed

Whether the sidebar is collapsed of not at start. TRUE by default.

controlbar_overlay

Whether the sidebar covers the content when expanded. Default to TRUE.

enable_preloader

Whether to enable a page loader. FALSE by default.

loading_duration

Loader duration in seconds. 2s by default.

loading_background

Background color during page startup. Blue by default: https://www.w3schools.com/cssref/css_colors.asp.

Author(s)

David Granjon, dgranjon@ymail.com

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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
if(interactive()){
 library(shiny)
 library(bs4Dash)

 shiny::shinyApp(
   ui = bs4DashPage(
    enable_preloader = TRUE,
    navbar = bs4DashNavbar(),
    sidebar = bs4DashSidebar(),
    controlbar = bs4DashControlbar(),
    footer = bs4DashFooter(),
    title = "test",
    body = bs4DashBody()
   ),
   server = function(input, output) {}
 )
}

if(interactive()){
 library(shiny)
 library(bs4Dash)

 shiny::shinyApp(
   ui = dashboardPage(
   navbar = dashboardHeader(),
   sidebar = dashboardSidebar(),
   body = dashboardBody(
     fluidRow(
       column(width = 4, plotOutput("distPlot")),
       column(width = 4, tableOutput("data")),
       column(width = 4, textOutput("result"))
     )
   ),
   controlbar = dashboardControlbar(
     skin = "light",
     tabsetPanel(
       type = "tabs",
       id = "tabsetpanel",
       tabPanel(
         title = "Tab 1",
         br(),
         sliderInput(
           "obs",
           "Number of observations:",
           min = 0,
           max = 1000,
           value = 500
         )
       ),
       tabPanel(
         title = "Tab 2",
         br(),
         checkboxGroupInput(
           "variable",
           "Variables to show:",
           c("Cylinders" = "cyl",
             "Transmission" = "am",
             "Gears" = "gear")
         )
       ),
       tabPanel(
         title = "Tab 3",
         br(),
         selectInput(
           "state",
           "Choose a state:",
           list(`East Coast` = list("NY", "NJ", "CT"),
                `West Coast` = list("WA", "OR", "CA"),
                `Midwest` = list("MN", "WI", "IA")
           )
         )
       )
     )
    )
   ),
   server = function(input, output) {
    output$distPlot <- renderPlot({
     hist(rnorm(input$obs))
    })
   
    output$data <- renderTable({
      head(mtcars[, c("mpg", input$variable), drop = FALSE])
    }, rownames = TRUE)
   
    output$result <- renderText({
      paste("You chose", input$state)
    })
   }
 )
}

bs4Dash documentation built on Dec. 1, 2019, 1:28 a.m.