bs4Dash (version 0.5.0)

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

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

Examples

Run this code
# NOT RUN {
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
         ))
       }
     })
   }
 )
}

# }

Run the code above in your browser using DataCamp Workspace