% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/glass_tabs.R
\name{showGlassTab}
\alias{showGlassTab}
\alias{hideGlassTab}
\title{Show or hide a glass tab}
\usage{
showGlassTab(session, id, value)

hideGlassTab(session, id, value)
}
\arguments{
\item{session}{Shiny session object.}

\item{id}{Module id matching the \code{id} passed to \code{\link[=glassTabsUI]{glassTabsUI()}}.}

\item{value}{Value of the tab to show or hide.}
}
\value{
Called for its side effect; returns \code{NULL} invisibly.
}
\description{
\code{showGlassTab()} makes a hidden tab visible again.
\code{hideGlassTab()} hides a tab from the navigation bar. If the hidden tab is
currently active, the first remaining visible tab is activated automatically.
}
\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)
}
}
