mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-14 01:18:07 -05:00
* Update roxygen and regenerate. Mostly just whitespace changes and `code` -> `verb`. * R6 documentation for MockShinySession * Install roxygen from GH * % are now auto-escaped (We still need to go find the rest) * Fixed the ramining \% in roxygen Found looking for ^#'.*\\% in all R files, so I believe this is all of them. * Regenerate docs * Decreate indent in roxygen so paragraphs don't get interpreted as code blocks. https://github.com/r-lib/roxygen2/issues/948#issuecomment-546386172 * Namespace * Add MockShinySession reference to pkgdown. * Clean up test warnings * Export session
85 lines
2.5 KiB
R
85 lines
2.5 KiB
R
% Generated by roxygen2: do not edit by hand
|
|
% Please edit documentation in R/insert-tab.R
|
|
\name{showTab}
|
|
\alias{showTab}
|
|
\alias{hideTab}
|
|
\title{Dynamically hide/show a tabPanel}
|
|
\usage{
|
|
showTab(inputId, target, select = FALSE, session = getDefaultReactiveDomain())
|
|
|
|
hideTab(inputId, target, session = getDefaultReactiveDomain())
|
|
}
|
|
\arguments{
|
|
\item{inputId}{The \code{id} of the \code{tabsetPanel} (or
|
|
\code{navlistPanel} or \code{navbarPage}) in which to find
|
|
\code{target}.}
|
|
|
|
\item{target}{The \code{value} of the \code{tabPanel} to be
|
|
hidden/shown. See Details if you want to hide/show an entire
|
|
\code{navbarMenu} instead.}
|
|
|
|
\item{select}{Should \code{target} be selected upon being shown?}
|
|
|
|
\item{session}{The shiny session within which to call this function.}
|
|
}
|
|
\description{
|
|
Dynamically hide or show a \code{\link[=tabPanel]{tabPanel()}} (or a
|
|
\code{\link[=navbarMenu]{navbarMenu()}})from an existing \code{\link[=tabsetPanel]{tabsetPanel()}},
|
|
\code{\link[=navlistPanel]{navlistPanel()}} or \code{\link[=navbarPage]{navbarPage()}}.
|
|
}
|
|
\details{
|
|
For \code{navbarPage}, you can hide/show conventional
|
|
\code{tabPanel}s (whether at the top level or nested inside a
|
|
\code{navbarMenu}), as well as an entire \code{\link[=navbarMenu]{navbarMenu()}}.
|
|
For the latter case, \code{target} should be the \code{menuName} that
|
|
you gave your \code{navbarMenu} when you first created it (by default,
|
|
this is equal to the value of the \code{title} argument).
|
|
}
|
|
\examples{
|
|
## Only run this example in interactive R sessions
|
|
if (interactive()) {
|
|
|
|
ui <- navbarPage("Navbar page", id = "tabs",
|
|
tabPanel("Home",
|
|
actionButton("hideTab", "Hide 'Foo' tab"),
|
|
actionButton("showTab", "Show 'Foo' tab"),
|
|
actionButton("hideMenu", "Hide 'More' navbarMenu"),
|
|
actionButton("showMenu", "Show 'More' navbarMenu")
|
|
),
|
|
tabPanel("Foo", "This is the foo tab"),
|
|
tabPanel("Bar", "This is the bar tab"),
|
|
navbarMenu("More",
|
|
tabPanel("Table", "Table page"),
|
|
tabPanel("About", "About page"),
|
|
"------",
|
|
"Even more!",
|
|
tabPanel("Email", "Email page")
|
|
)
|
|
)
|
|
|
|
server <- function(input, output, session) {
|
|
observeEvent(input$hideTab, {
|
|
hideTab(inputId = "tabs", target = "Foo")
|
|
})
|
|
|
|
observeEvent(input$showTab, {
|
|
showTab(inputId = "tabs", target = "Foo")
|
|
})
|
|
|
|
observeEvent(input$hideMenu, {
|
|
hideTab(inputId = "tabs", target = "More")
|
|
})
|
|
|
|
observeEvent(input$showMenu, {
|
|
showTab(inputId = "tabs", target = "More")
|
|
})
|
|
}
|
|
|
|
shinyApp(ui, server)
|
|
}
|
|
|
|
}
|
|
\seealso{
|
|
\code{\link[=insertTab]{insertTab()}}
|
|
}
|