updateGlassTabsUI: Programmatically switch the active glass tab

View source: R/glass_tabs.R

updateGlassTabsUIR Documentation

Programmatically switch the active glass tab

Description

Server-side equivalent of Shiny's updateTabsetPanel(). Sends a message to the browser to animate the tab switch just as if the user had clicked the tab button.

Usage

updateGlassTabsUI(session, id, selected)

Arguments

session

Shiny session object.

id

Module id matching the id passed to glassTabsUI().

selected

Value of the tab to activate.

Value

Called for its side effect; returns NULL invisibly.

See Also

Other glass tabs: appendGlassTab(), disableGlassTab(), glassTabCondition(), glassTabPanel(), glassTabsOutput(), glassTabsServer(), glassTabsUI(), renderGlassTabs(), showGlassTab(), updateGlassTabBadge()

Examples

if (interactive()) {
  library(shiny)
  ui <- fluidPage(
    useGlassTabs(),
    glassTabsUI(
      "tabs",
      glassTabPanel("a", "A", p("Tab A"), selected = TRUE),
      glassTabPanel("b", "B", p("Tab B"))
    ),
    actionButton("go", "Go to B")
  )
  server <- function(input, output, session) {
    observeEvent(input$go, {
      updateGlassTabsUI(session, "tabs", selected = "b")
    })
  }
  shinyApp(ui, server)
}

glasstabs documentation built on Sept. 11, 2026, 5:08 p.m.