Skip to contents

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.

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)
}