tabsetPanel | R Documentation |
Create a tabset that contains tabPanel()
elements. Tabsets are
useful for dividing output into multiple independently viewable sections.
tabsetPanel(
...,
id = NULL,
selected = NULL,
type = c("tabs", "pills", "hidden"),
header = NULL,
footer = NULL
)
... |
|
id |
If provided, you can use |
selected |
The |
type |
|
header |
Tag or list of tags to display as a common header above all tabPanels. |
footer |
Tag or list of tags to display as a common footer below all tabPanels |
A tabset that can be passed to mainPanel()
tabPanel()
, updateTabsetPanel()
,
insertTab()
, showTab()
# Show a tabset that includes a plot, summary, and
# table view of the generated distribution
mainPanel(
tabsetPanel(
tabPanel("Plot", plotOutput("plot")),
tabPanel("Summary", verbatimTextOutput("summary")),
tabPanel("Table", tableOutput("table"))
)
)
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
radioButtons("controller", "Controller", 1:3, 1)
),
mainPanel(
tabsetPanel(
id = "hidden_tabs",
# Hide the tab values.
# Can only switch tabs by using `updateTabsetPanel()`
type = "hidden",
tabPanelBody("panel1", "Panel 1 content"),
tabPanelBody("panel2", "Panel 2 content"),
tabPanelBody("panel3", "Panel 3 content")
)
)
)
)
server <- function(input, output, session) {
observeEvent(input$controller, {
updateTabsetPanel(session, "hidden_tabs", selected = paste0("panel", input$controller))
})
}
if (interactive()) {
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.