shinydashboard:: switch tab
https://rdrr.io/cran/shinydashboard/man/updateTabItems.html
## Only run this example in interactive R sessions library(shiny) library(shinydashboard) ui <- dashboardPage( dashboardHeader(title = "Simple tabs"), dashboardSidebar( sidebarMenu( id = "tabs", menuItem("Dashboard", tabName = "dashboard",icon = icon("dashboard") ), menuItem("Widgets", tabName = "widgets", icon = icon("th")) ), actionButton('btn_switchtab', 'Switch tab') ), dashboardBody( tabItems( tabItem(tabName = "dashboard", h2("Dashboard tab content"), verbatimTextOutput("dashboard_tab") ), tabItem(tabName = "widgets", h2("Widgets tab content"), verbatimTextOutput("widgets_tab") ) ) ) ) server <- function(input, output, session) { observeEvent(input$btn_switchtab, { newtab <- switch(input$tabs, "dashboard" = "widgets", "widgets" = "dashboard" ) updateTabItems(session, "tabs", newtab) }) output$dashboard_tab <- renderText({ input$tabs }) output$widgets_tab <- renderText({ input$tabs }) } shinyApp(ui, server)