A dashboardSidebar
can contain a sidebarMenu
. A
sidebarMenu
contains menuItem
s, and they can in turn contain
menuSubItem
s.
sidebarMenu(..., id = NULL, .list = NULL) menuItem(text, ..., icon = NULL, badgeLabel = NULL, badgeColor = "green", tabName = NULL, href = NULL, newtab = TRUE, selected = NULL, expandedName = as.character(gsub("[[:space:]]", "", text)), startExpanded = FALSE) menuSubItem(text, tabName = NULL, href = NULL, newtab = TRUE, icon = shiny::icon("angle-double-right"), selected = NULL)
... | For menu items, this may consist of |
---|---|
id | For |
.list | An optional list containing items to put in the menu Same as the
|
text | Text to show for the menu item. |
icon | An icon tag, created by |
badgeLabel | A label for an optional badge. Usually a number or a short word like "new". |
badgeColor | A color for the badge. Valid colors are listed in validColors. |
tabName | The name of a tab that this menu item will activate. Not
compatible with |
href | An link address. Not compatible with |
newtab | If |
selected | If |
expandedName | A unique name given to each |
startExpanded | Should this |
Menu items (and similarly, sub-items) should have a value for either
href
or tabName
; otherwise the item would do nothing. If it has
a value for href
, then the item will simply be a link to that value.
If a menuItem
has a non-NULL tabName
, then the menuItem
will behave like a tab -- in other words, clicking on the menuItem
will bring a corresponding tabItem
to the front, similar to a
tabPanel
. One important difference between a
menuItem
and a tabPanel
is that, for a menuItem
, you
must also supply a corresponding tabItem
with the same value for
tabName
, whereas for a tabPanel
, no tabName
is needed.
(This is because the structure of a tabPanel
is such that the tab name
can be automatically generated.) Sub-items are also able to activate
tabItem
s.
Menu items (but not sub-items) also may have an optional badge. A badge is a colored oval containing text.
dashboardSidebar
for example usage. For
dynamically-generated sidebar menus, see renderMenu
and
sidebarMenuOutput
.
Other sidebar items: sidebarSearchForm
,
sidebarUserPanel