Skip to contents

Create a sidebar menu with menu items.

Usage

sidebar_menu(..., id = "uisidebar")

sidebarMenu(..., id = "uisidebar")

Arguments

...

Menu items.

id

The sidebar id class also used for update input on server side. Default is uisidebar

Value

A sidebar menu that can be passed dashboardSidebar

Details

It's possible to set selected menu item by setting `selected = TRUE` in `menuItem`.

Functions

  • sidebarMenu(): Create a sidebar menu (alias for sidebar_menu for compatibility with shinydashboard)

Examples

sidebarMenu(
  menuItem(tabName = "plot_tab", text = "My plot", icon = icon("home")),
  menuItem(tabName = "table_tab", text = "My table", icon = icon("smile"), selected = TRUE)
  )
#> $id
#> [1] "uisidebar"
#> 
#> [[2]]
#> <a class="item" href="#shiny-tab-plot_tab" data-tab="shiny-tab-plot_tab" data-toggle="tab" data-value="plot_tab">
#>   <i class="home icon"></i>
#>   My plot
#> </a>
#> 
#> [[3]]
#> <a class="item" href="#shiny-tab-table_tab" data-tab="shiny-tab-table_tab" data-toggle="tab" data-value="table_tab">
#>   <i class="smile icon"></i>
#>   My table
#>   <script>  $(function() {
#>     ['.dashboard-sidebar a', '.tab-content > div'].forEach(function(tag) {
#>       $(`${tag}[data-tab]`).removeClass('active');
#>       $(`${tag}[data-tab="shiny-tab-table_tab"]`).addClass('active');
#>     })
#>   })</script>
#> </a>
#>