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)