Skip to contents

Update a Bootstrap 386 tabset panel on the client

Usage

update_tabset_panel_386(
  session = getDefaultReactiveDomain(),
  inputId,
  selected = NULL
)

Arguments

session

The session object passed to function given to shinyServer. Default is getDefaultReactiveDomain().

inputId

The id of the tabsetPanel, navlistPanel, or navbarPage object.

selected

The value (or, if none was supplied, the title) of the tab that should be selected by default. If NULL, the first tab will be selected.

Examples

if (interactive()) {
 library(shiny)
 library(shiny386)

 ui <- page_386(sidebarLayout(
 sidebarPanel(
   radio_input_386("controller", "Controller", choices = c(1, 2, 3))
 ),
 mainPanel(
   tabset_panel_386(id = "inTabset",
               tab_panel_386(title = "Panel 1", value = "panel1", "Panel 1 content"),
               tab_panel_386(title = "Panel 2", value = "panel2", "Panel 2 content"),
               tab_panel_386(title = "Panel 3", value = "panel3", "Panel 3 content")
   )
 )
 ))

 server <- function(input, output, session) {
   observeEvent(input$controller, {
     update_tabset_panel_386(session, "inTabset",
                       selected = paste0("panel", input$controller)
     )
   })
 }

 shinyApp(ui, server)
}