showGlassTab: Show or hide a glass tab

View source: R/glass_tabs.R

showGlassTabR Documentation

Show or hide a glass tab

Description

showGlassTab() makes a hidden tab visible again. hideGlassTab() hides a tab from the navigation bar. If the hidden tab is currently active, the first remaining visible tab is activated automatically.

Usage

showGlassTab(session, id, value)

hideGlassTab(session, id, value)

Arguments

session

Shiny session object.

id

Module id matching the id passed to glassTabsUI().

value

Value of the tab to show or hide.

Value

Called for its side effect; returns NULL invisibly.

See Also

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

Examples

if (interactive()) {
  library(shiny)
  ui <- fluidPage(
    useGlassTabs(),
    glassTabsUI(
      "tabs",
      glassTabPanel("a", "A", p("Tab A"), selected = TRUE),
      glassTabPanel("b", "B", p("Tab B")),
      glassTabPanel("admin", "Admin", p("Admin only"))
    ),
    checkboxInput("is_admin", "Admin mode", FALSE)
  )
  server <- function(input, output, session) {
    observeEvent(input$is_admin, {
      if (input$is_admin) showGlassTab(session, "tabs", "admin")
      else                hideGlassTab(session, "tabs", "admin")
    }, ignoreInit = FALSE)
  }
  shinyApp(ui, server)
}

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