update_tab_items: Change the selected tab on the client

View source: R/menu_item.R

update_tab_itemsR Documentation

Change the selected tab on the client

Description

Change the selected tab on the client

Usage

update_tab_items(session = shiny::getDefaultReactiveDomain(), tab)

updateTabItems(session = shiny::getDefaultReactiveDomain(), tab)

Arguments

session

The session object passed to function given to shinyServer

tab

The name of the tab that should be selected

Functions

  • updateTabItems(): Change the selected item on the client (alias for update_tab_items for compatibility with shinydashboard)

Examples

if (interactive()) {
  ui <- dashboardPage(
    dashboardSidebar(
      sidebarMenu(
        menuItem("Tab 1", tabName = "tab1"),
        menuItem("Tab 2", tabName = "tab2")
      )
    ),
    dashboardBody(
      tabItems(
        tabItem(tabName = "tab1", h2("Tab 1")),
        tabItem(tabName = "tab2", h2("Tab 2"))
     )
   )
  )

  server <- function(input, output, session) {
    update_tab_items(tab = "tab2")
  }

  shinyApp(ui, server)
}

Appsilon/semantic.dashboard documentation built on April 21, 2024, 2:42 p.m.