updateTabsetPanel | R Documentation |
Change the selected tab on the client
updateTabsetPanel(
session = getDefaultReactiveDomain(),
inputId,
selected = NULL
)
updateNavbarPage(
session = getDefaultReactiveDomain(),
inputId,
selected = NULL
)
updateNavlistPanel(
session = getDefaultReactiveDomain(),
inputId,
selected = NULL
)
session |
The |
inputId |
The id of the |
selected |
The |
tabsetPanel()
, navlistPanel()
,
navbarPage()
## Only run examples in interactive R sessions
if (interactive()) {
ui <- fluidPage(sidebarLayout(
sidebarPanel(
sliderInput("controller", "Controller", 1, 3, 1)
),
mainPanel(
tabsetPanel(id = "inTabset",
tabPanel(title = "Panel 1", value = "panel1", "Panel 1 content"),
tabPanel(title = "Panel 2", value = "panel2", "Panel 2 content"),
tabPanel(title = "Panel 3", value = "panel3", "Panel 3 content")
)
)
))
server <- function(input, output, session) {
observeEvent(input$controller, {
updateTabsetPanel(session, "inTabset",
selected = paste0("panel", input$controller)
)
})
}
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.