1% Generated by roxygen2: do not edit by hand 2% Please edit documentation in R/insert-tab.R 3\name{showTab} 4\alias{showTab} 5\alias{hideTab} 6\title{Dynamically hide/show a tabPanel} 7\usage{ 8showTab(inputId, target, select = FALSE, session = getDefaultReactiveDomain()) 9 10hideTab(inputId, target, session = getDefaultReactiveDomain()) 11} 12\arguments{ 13\item{inputId}{The \code{id} of the \code{tabsetPanel} (or 14\code{navlistPanel} or \code{navbarPage}) in which to find 15\code{target}.} 16 17\item{target}{The \code{value} of the \code{tabPanel} to be 18hidden/shown. See Details if you want to hide/show an entire 19\code{navbarMenu} instead.} 20 21\item{select}{Should \code{target} be selected upon being shown?} 22 23\item{session}{The shiny session within which to call this function.} 24} 25\description{ 26Dynamically hide or show a \code{\link[=tabPanel]{tabPanel()}} (or a 27\code{\link[=navbarMenu]{navbarMenu()}})from an existing \code{\link[=tabsetPanel]{tabsetPanel()}}, 28\code{\link[=navlistPanel]{navlistPanel()}} or \code{\link[=navbarPage]{navbarPage()}}. 29} 30\details{ 31For \code{navbarPage}, you can hide/show conventional 32\code{tabPanel}s (whether at the top level or nested inside a 33\code{navbarMenu}), as well as an entire \code{\link[=navbarMenu]{navbarMenu()}}. 34For the latter case, \code{target} should be the \code{menuName} that 35you gave your \code{navbarMenu} when you first created it (by default, 36this is equal to the value of the \code{title} argument). 37} 38\examples{ 39## Only run this example in interactive R sessions 40if (interactive()) { 41 42ui <- navbarPage("Navbar page", id = "tabs", 43 tabPanel("Home", 44 actionButton("hideTab", "Hide 'Foo' tab"), 45 actionButton("showTab", "Show 'Foo' tab"), 46 actionButton("hideMenu", "Hide 'More' navbarMenu"), 47 actionButton("showMenu", "Show 'More' navbarMenu") 48 ), 49 tabPanel("Foo", "This is the foo tab"), 50 tabPanel("Bar", "This is the bar tab"), 51 navbarMenu("More", 52 tabPanel("Table", "Table page"), 53 tabPanel("About", "About page"), 54 "------", 55 "Even more!", 56 tabPanel("Email", "Email page") 57 ) 58) 59 60server <- function(input, output, session) { 61 observeEvent(input$hideTab, { 62 hideTab(inputId = "tabs", target = "Foo") 63 }) 64 65 observeEvent(input$showTab, { 66 showTab(inputId = "tabs", target = "Foo") 67 }) 68 69 observeEvent(input$hideMenu, { 70 hideTab(inputId = "tabs", target = "More") 71 }) 72 73 observeEvent(input$showMenu, { 74 showTab(inputId = "tabs", target = "More") 75 }) 76} 77 78shinyApp(ui, server) 79} 80 81} 82\seealso{ 83\code{\link[=insertTab]{insertTab()}} 84} 85