update_tabset: Change the selected tab of a tabset on the client

Description Usage Arguments Examples

View source: R/dsl.R

Description

Change the selected tab of a tabset on the client

Usage

1
update_tabset(session, input_id, selected = NULL)

Arguments

session

The session object passed to function given to shinyServer.

input_id

The id of the tabset object.

selected

The id of the tab to be selected.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
if (interactive()){
 library(shiny)
 library(shiny.semantic)

 ui <- semanticPage(
   actionButton("changetab", "Select Second Tab"),
   tabset(
      tabs = list(
          list(menu = "First Tab", content = "First Tab", id= "first_tab"),
          list(menu = "Second Tab", content = "Second Tab", id = "second_tab")
      ),
      active = "first_tab",
      id = "exampletabset"
   )
 )

 server <- function(input, output, session) {
     observeEvent(input$changetab,{
         update_tabset(session, "exampletabset", "second_tab")
     })
 }

 shinyApp(ui, server)
}

shiny.semantic documentation built on Nov. 7, 2021, 5:07 p.m.