bs4SidebarMenuItem: Create a Boostrap 4 dashboard main sidebar menu item

Description Usage Arguments Note Author(s) Examples

View source: R/dashboardSidebar.R

Description

Build an adminLTE3 dashboard main sidebar menu item

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
bs4SidebarMenuItem(
  text,
  ...,
  tabName = NULL,
  icon = NULL,
  expandedName = as.character(gsub("[[:space:]]", "", text)),
  startExpanded = FALSE,
  condition = NULL,
  selected = NULL
)

menuItem(
  text,
  ...,
  tabName = NULL,
  icon = NULL,
  expandedName = as.character(gsub("[[:space:]]", "", text)),
  startExpanded = FALSE,
  condition = NULL,
  selected = NULL
)

Arguments

text

Item name.

...

bs4SidebarMenuSubItem.

tabName

Should correspond exactly to the tabName given in bs4TabItem.

icon

Item icon.

expandedName

A unique name given to each menuItem that serves to indicate which one (if any) is currently expanded. (This is only applicable to menuItems that have children and it is mostly only useful for bookmarking state.)

startExpanded

Whether to expand the bs4SidebarMenuItem at start.

condition

When using bs4SidebarMenuItem with conditionalPanel, write the condition here (see https://github.com/RinteRface/bs4Dash/issues/35).

selected

If TRUE, this bs4SidebarMenuItem will start selected. If no item have selected=TRUE, then the first bs4SidebarMenuItem will start selected.

Note

See examples for a use case of the condition parameter.

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
if (interactive()) {
 # sidebarItem with conditional value
 library(shiny)
 library(bs4Dash)
 
 ui <- bs4DashPage(
  bs4DashNavbar(),
  bs4DashSidebar(
    bs4SidebarMenu(
      id = "sidebarMenu",
      bs4SidebarMenuItem(
        text = "Tab 1",
        tabName = "tab1"
      ),
      bs4SidebarMenuItem(
        condition = "input.show == true",
        text = "Tab 2",
        tabName = "tab2"
      )
    )
  ),
  bs4DashBody(
    bs4TabItems(
      bs4TabItem(
        tabName = "tab1",
        h1("Welcome!"),
        checkboxInput("show", "Show Tab 2", FALSE)
      ),
      bs4TabItem(
        tabName = "tab2",
        h1("Hey! You found me!")
      )
    )
   )
  )
  server <- function(input, output){}
  shinyApp(ui = ui, server = server)
}

RX-PBB/bs4Mash documentation built on April 11, 2020, 12:15 a.m.