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

bs4SidebarMenu

Create a Boostrap 4 dashboard main sidebar menu


Description

Build an adminLTE3 dashboard main sidebar menu

Usage

bs4SidebarMenu(
  ...,
  id = NULL,
  flat = FALSE,
  compact = FALSE,
  child_indent = TRUE
)

sidebarMenu(..., id = NULL, flat = FALSE, compact = FALSE, child_indent = TRUE)

Arguments

...

Slot for bs4SidebarMenuItem or bs4SidebarHeader.

id

For bs4SidebarMenu, if id is present, this id will be used for a Shiny input value, and it will report which tab is selected. For example, if id="tabs", then input$tabs will be the tabName of the currently-selected bs4SidebarMenuItem.

flat

Whether sidebar items should have a flat design. FALSE by default.

compact

Whether items should be compacted. FALSE by default.

child_indent

Whether to indent children. TRUE by default

Author(s)

David Granjon, dgranjon@ymail.com

Examples

if (interactive()) {
 library(shiny)
 library(bs4Dash)
 
 shinyApp(
   ui = bs4DashPage(
     sidebar_collapsed = TRUE,
     controlbar_collapsed = TRUE,
     enable_preloader = FALSE,
     loading_duration =  2,
     navbar = bs4DashNavbar(skin = "light"),
     body = bs4DashBody(
       
     ),
     sidebar = bs4DashSidebar(
       skin = "light",
       bs4SidebarMenu(
         id = "test",
         bs4SidebarMenuItem(
           tabName = "tab1",
           text = "Tab 1"
         ),
         bs4SidebarMenuItem(
           tabName = "tab2",
           text = "Tab 2"
         ),
         bs4SidebarMenuItem(
           text = "Click me pleaaaaase",
           bs4SidebarMenuSubItem(
             tabName = "subtab1",
             text = "Tab 3"
           ),bs4SidebarMenuSubItem(
             tabName = "subtab2",
             text = "Tab 4"
           )
         )
       )
     ),
     controlbar = bs4DashControlbar(skin = "light"),
     footer = bs4DashFooter()
   ),
   server = function(input, output, session) {
     observeEvent(input$test, {
       if (input$test == "subtab1") {
         showModal(modalDialog(
           title = "Thank you so much",
           "You clicked me! This event is the result of
           an input bound to the menu. By adding an id to the
           bs4SidebarMenu, input$id will give the currently selected
           tab. This is useful to trigger some events.",
           easyClose = TRUE,
           footer = NULL
         ))
       }
     })
   }
 )
}

bs4Dash

A 'Bootstrap 4' Version of 'shinydashboard'

v0.5.0
GPL (>= 2) | file LICENSE
Authors
David Granjon [aut, cre], RinteRface [cph], Almasaeed Studio [ctb, cph] (AdminLTE3 theme for Bootstrap 4), Winston Chang [ctb, cph] (Utils functions from shinydashboard), Thomas Park [ctb, cph] (Bootswatch Sketchy theme CSS)
Initial release

We don't support your browser anymore

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