update_tab_items | R Documentation |
Change the selected tab on the client
update_tab_items(session = shiny::getDefaultReactiveDomain(), tab)
updateTabItems(session = shiny::getDefaultReactiveDomain(), tab)
session |
The session object passed to function given to shinyServer |
tab |
The name of the tab that should be selected |
updateTabItems()
: Change the selected item on the client (alias for
update_tab_items
for compatibility with shinydashboard
)
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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.