mirror of
https://github.com/rstudio/shiny.git
synced 2026-02-07 13:15:00 -05:00
55 lines
1.5 KiB
R
55 lines
1.5 KiB
R
% Generated by roxygen2: do not edit by hand
|
|
% Please edit documentation in R/insert-ui.R
|
|
\name{removeTab}
|
|
\alias{removeTab}
|
|
\title{Dynamically remove a tabPanel}
|
|
\usage{
|
|
removeTab(tabsetPanelId, target, immediate = FALSE,
|
|
session = getDefaultReactiveDomain())
|
|
}
|
|
\arguments{
|
|
\item{tabsetPanelId}{The \code{id} of the \code{tabsetPanel()} from which
|
|
\code{target} will be removed.}
|
|
|
|
\item{target}{The \code{value} of the \code{tabPanel()} to be removed.}
|
|
|
|
\item{immediate}{Whether \code{tab} should be immediately removed from
|
|
the app when you call \code{removeTab}, or whether Shiny should wait until
|
|
all outputs have been updated and all observers have been run (default).}
|
|
|
|
\item{session}{The shiny session within which to call \code{removeTab}.}
|
|
}
|
|
\description{
|
|
Dynamically remove a \code{tabPanel()} from an existing \code{tabsetPanel}.
|
|
}
|
|
\examples{
|
|
## Only run this example in interactive R sessions
|
|
if (interactive()) {
|
|
ui <- fluidPage(
|
|
sidebarLayout(
|
|
sidebarPanel(actionButton("remove", "Remove tab")),
|
|
mainPanel(
|
|
tabsetPanel(id = "tabs"
|
|
tabPanel("Hello", "This is the hello tab"),
|
|
tabPanel("Foo", "This is the foo tab"),
|
|
tabPanel("Bar", "This is the bar tab")
|
|
)
|
|
)
|
|
)
|
|
)
|
|
server <- function(input, output, session) {
|
|
observeEvent(input$remove, {
|
|
removeTab(tabsetPanelId = "tabs",
|
|
target = "Bar"
|
|
)
|
|
})
|
|
}
|
|
|
|
shinyApp(ui, server)
|
|
}
|
|
}
|
|
\seealso{
|
|
\code{\link{insertTab}}, \code{\link{showTab}},
|
|
\code{\link{hideTab}}
|
|
}
|