R: Create a dashboard sidebar menu and menu items.

sidebarMenu {shinydashboard} | R Documentation

## Create a dashboard sidebar menu and menu items.

### Description

A `dashboardSidebar` can contain a `sidebarMenu`. A `sidebarMenu` contains `menuItem`s, and they can in turn contain `menuSubItem`s.

### Usage

    sidebarMenu(..., id = NULL, .list = NULL)

    menuItem(text, ..., icon = NULL, badgeLabel = NULL, badgeColor = "green",
      tabName = NULL, href = NULL, newtab = TRUE, selected = NULL)

    menuSubItem(text, tabName = NULL, href = NULL, newtab = TRUE,
      icon = shiny::icon("angle-double-right"), selected = NULL)

### Arguments

`...` | For menu items, this may consist of `menuSubItem`s.
`id` | For `sidebarMenu`, 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 tab. If you want to be able to bookmark and restore the selected tab, an `id` is required.
`.list` | An optional list containing items to put in the menu Same as the `...` arguments, but in list format. This can be useful when working with programmatically generated items.
`text` | Text to show for the menu item.
`icon` | An icon tag, created by `icon`. If `NULL`, don't display an icon.
`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`.
`href` | An link address. Not compatible with `tabName`.
`newtab` | If `href` is supplied, should the link open in a new browser tab?
`selected` | If `TRUE`, this `menuItem` or `menuSubItem` will start selected. If no item have `selected=TRUE`, then the first `menuItem` will start selected.

### Details

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.

### See Also

`dashboardSidebar` for example usage. For dynamically-generated sidebar menus, see `renderMenu` and `sidebarMenuOutput`.

Other sidebar items: `sidebarSearchForm`, `sidebarUserPanel`

[Package shinydashboard version 0.5.3 Index]