Shiny - Clicar em um button e aparecer tabsetPanel

Pessoal

Como faço para clicar em um botão no shiny e aparecer o conjunto de paineis abaixo.

Esse é meu código. Há como eu iniciar a tela no primeiro painel e a medida q clico nos botões aparece os tabsetPanels?

Outra coisa: tenho como melhorar a parte dos observeEvents?

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
  actionButton("btn_1", "tabSet 1"),
  actionButton("btn_2", "tabSet 2"),
  
  actionButton("btn_3", "tabSet 3"),
  actionButton("btn_4", "tabSet 4"),
  
  uiOutput("tabset")
  )

server <- function(input, output, session) {
  
 observeEvent(input$btn_1,{
    
    output$tabset  <- renderUI({
      tabsetPanel(
        tabPanel(
          h6("TabPanel 1")
        ),
        tabPanel(
          h6("TabPanel 2")
        ),
        tabPanel(
          h6("TabPanel 3")
        ),
        tabPanel(
          h6("TabPanel 4")
        )
        
      )
    })
    
  })
  
  observeEvent(input$btn_2,{
    
    output$tabset  <- renderUI({
      tabsetPanel(
        tabPanel(
          h6("TabPanel 1")
        )
        
      )
    })
    
  })
  
  observeEvent(input$btn_3,{
    
    output$tabset  <- renderUI({
      tabsetPanel(
        tabPanel(
          h6("TabPanel 3")
        ),
        
        tabPanel(
          h6("TabPanel 3")
        ),
        
        tabPanel(
          h6("TabPanel 3")
        ),
        
        tabPanel(
          h6("TabPanel 3")
        ),
        
        tabPanel(
          h6("TabPanel 3")
        )
        
        
      )
    })
    
  })
  
  observeEvent(input$btn_4,{
    
    output$tabset  <- renderUI({
      tabsetPanel(
        tabPanel(
          h1("LASt Button Title Panel")
        )
        
        
      )
    })
    
  })
  
  
}

shinyApp(ui, server)

Laura,

Não sei se entendi exatamente o que você quer fazer. Minha solução faz cada aba aparecer quando o botão correspondente é clicado; se o botão for clicado de novo, a aba some. Era isso mesmo ou você queria que acontecesse outra coisa?

library(shiny)

ui <- fluidPage(
  actionButton("btn_1", "tabSet 1"),
  actionButton("btn_2", "tabSet 2"),
  
  actionButton("btn_3", "tabSet 3"),
  actionButton("btn_4", "tabSet 4"),
  
  uiOutput("tabset")
)

server <- function(input, output, session) {
  
  output$tabset <- renderUI({
    panels <- list(
      tabPanel(h6("TabPanel 1")),
      tabPanel(h6("TabPanel 2")),
      tabPanel(h6("TabPanel 3")),
      tabPanel(h6("TabPanel 4"))
    )
    
    buttons <- c(
      input$btn_1 %% 2 == 1,
      input$btn_2 %% 2 == 1,
      input$btn_3 %% 2 == 1,
      input$btn_4 %% 2 == 1
    )

    purrr::lift_dl(tabsetPanel)(panels[buttons])
  })  
  
}

shinyApp(ui, server)

Se não for isso o que você quer, talvez o conditional panel te ajude.