Debian Codegraph @

man/tabsetPanel.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/bootstrap.R
3 \name{tabsetPanel}
4 \alias{tabsetPanel}
5 \title{Create a tabset panel}
6 \usage{
7 tabsetPanel(
8 ...,
9 id = NULL,
10 selected = NULL,
11 type = c("tabs", "pills", "hidden"),
12 header = NULL,
13 footer = NULL
14 )
15 }
16 \arguments{
17 \item{...}{\code{\link[=tabPanel]{tabPanel()}} elements to include in the tabset}
18
19 \item{id}{If provided, you can use \verb{input$}\emph{\code{id}} in your
20 server logic to determine which of the current tabs is active. The value
21 will correspond to the \code{value} argument that is passed to
22 \code{\link[=tabPanel]{tabPanel()}}.}
23
24 \item{selected}{The \code{value} (or, if none was supplied, the \code{title})
25 of the tab that should be selected by default. If \code{NULL}, the first
26 tab will be selected.}
27
28 \item{type}{\describe{
29 \item{\code{"tabs"}}{Standard tab look}
30 \item{\code{"pills"}}{Selected tabs use the background fill color}
31 \item{\code{"hidden"}}{Hides the selectable tabs. Use \code{type = "hidden"} in
32 conjunction with \code{\link[=tabPanelBody]{tabPanelBody()}} and \code{\link[=updateTabsetPanel]{updateTabsetPanel()}} to control the
33 active tab via other input controls. (See example below)}
34 }}
35
36 \item{header}{Tag or list of tags to display as a common header above all
37 tabPanels.}
38
39 \item{footer}{Tag or list of tags to display as a common footer below all
40 tabPanels}
41 }
42 \value{
43 A tabset that can be passed to \code{\link[=mainPanel]{mainPanel()}}
44 }
45 \description{
46 Create a tabset that contains \code{\link[=tabPanel]{tabPanel()}} elements. Tabsets are
47 useful for dividing output into multiple independently viewable sections.
48 }
49 \examples{
50 # Show a tabset that includes a plot, summary, and
51 # table view of the generated distribution
52 mainPanel(
53 tabsetPanel(
54 tabPanel("Plot", plotOutput("plot")),
55 tabPanel("Summary", verbatimTextOutput("summary")),
56 tabPanel("Table", tableOutput("table"))
57 )
58 )
59
60 ui <- fluidPage(
61 sidebarLayout(
62 sidebarPanel(
63 radioButtons("controller", "Controller", 1:3, 1)
64 ),
65 mainPanel(
66 tabsetPanel(
67 id = "hidden_tabs",
68 # Hide the tab values.
69 # Can only switch tabs by using `updateTabsetPanel()`
70 type = "hidden",
71 tabPanelBody("panel1", "Panel 1 content"),
72 tabPanelBody("panel2", "Panel 2 content"),
73 tabPanelBody("panel3", "Panel 3 content")
74 )
75 )
76 )
77 )
78
79 server <- function(input, output, session) {
80 observeEvent(input$controller, {
81 updateTabsetPanel(session, "hidden_tabs", selected = paste0("panel", input$controller))
82 })
83 }
84
85 if (interactive()) {
86 shinyApp(ui, server)
87 }
88 }
89 \seealso{
90 \code{\link[=tabPanel]{tabPanel()}}, \code{\link[=updateTabsetPanel]{updateTabsetPanel()}},
91 \code{\link[=insertTab]{insertTab()}}, \code{\link[=showTab]{showTab()}}
92 }