Using the rightSidebar

David Granjon

2020-07-15

The rightSidebar

The most interesting feature of this package is the rightSidebar(). This concept was not implemented (in R) in ygdashboard (pure HTML), that’s why I translated the corresponding HTML code to R. To use it, you will have to replace dashboardPage() by dashboardPagePlus() and dashboardHeader() by dashboardHeaderPlus(). Creating this two additional functions let you choose whether you want to use this extra sidebar or not.

The template below will create the most basic shinydashboardPlus page:

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
shinyApp(
  ui = dashboardPagePlus(
    header = dashboardHeaderPlus(
     enable_rightsidebar = TRUE,
     rightSidebarIcon = "gears"
    ),
    sidebar = dashboardSidebar(),
    body = dashboardBody(),
    rightsidebar = rightSidebar(),
    title = "DashboardPage"
  ),
  server = function(input, output) { }
)

The rightSidebar function takes the following arguments:


rightSidebar(
 background = "dark",
  rightSidebarTabContent(
   id = 1,
   icon = "desktop",
   active = TRUE,
   title = "Tab 1",
   sliderInput(
    "obs", 
    "Number of observations:",
     min = 0, max = 1000, value = 500
    )
  ),
  rightSidebarTabContent(
   id = 2,
   title = "Tab 2",
   textInput("caption", "Caption", "Data Summary")
  ),
  rightSidebarTabContent(
   id = 3,
   icon = "paint-brush",
   title = "Tab 3",
   numericInput("obs", "Observations:", 10, min = 1, max = 100)
  )
)

WARNINGS: there is a limitation of a maximum of 5 rightSidebarTabContent() in the rightSidebar(). This limitation is internal to AdminLTE2.