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

boxSidebar

Create a sidebar for a box


Description

boxSidebar is inserted in the sidebar slot of box.

updateBoxSidebar toggle a boxSidebar on the client.

Usage

boxSidebar(
  ...,
  id = NULL,
  width = 50,
  background = "#333a40",
  startOpen = FALSE,
  icon = shiny::icon("cogs")
)

updateBoxSidebar(id, session = shiny::getDefaultReactiveDomain())

Arguments

...

Sidebar content.

id

Sidebar id.

width

Sidebar opening width in percentage. 50% by default, means the card sidebar will take 50 A numeric value between 25 and 100.

background

Sidebar background color. Dark by default. Expect a HEX code.

startOpen

Whether the sidebar is open at start. FALSE by default.

icon

Sidebar icon. Expect icon.

session

Shiny session object.

Examples

# Toggle a box sidebar
if (interactive()) {
 library(shiny)
 library(shinydashboard)
 library(shinydashboardPlus)
 
 shinyApp(
  ui = dashboardPage(
    header = dashboardHeader(),
    body = dashboardBody(
      box(
        title = "Update box sidebar", 
        closable = TRUE, 
        width = 12,
        height = "500px",
        solidHeader = FALSE, 
        collapsible = TRUE,
        actionButton("update", "Toggle card sidebar"),
        sidebar = boxSidebar(
          id = "mycardsidebar",
          p("Sidebar Content")
        )
      )
    ),
    sidebar = dashboardSidebar()
  ),
  server = function(input, output, session) {
    observe(print(input$mycardsidebar))
    
    observeEvent(input$update, {
      updateBoxSidebar("mycardsidebar")
    })
    
  }
 )
}

shinydashboardPlus

Add More 'AdminLTE2' Components to 'shinydashboard'

v2.0.1
GPL (>= 2) | file LICENSE
Authors
David Granjon [aut, cre], RinteRface [cph], Almasaeed Studio [ctb, cph] (AdminLTE2 theme for Bootstrap 3), Guang Yang [ctb, cph] (ygdashboard original template), Winston Chang [ctb, cph] (Functions from shinydashboard), Victor Perrier [ctb] (improved the shinydashboardPlusGallery)
Initial release

We don't support your browser anymore

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