I would like to have dynamic tabs for my shiny app. I tried the below code
## app.R ##
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
checkboxGroupInput("Tabs",
label = h4("tabpanel"),
choices = list("tabs" = "tabs"),
selected = NULL),
checkboxGroupInput("moreTabs",
label = h4("moretabpanel"),
choices = list("moretabs" = "moretabs"),
selected = NULL)
),
dashboardBody(
conditionalPanel(
condition = "input.Tabs == 'tabs'",
tabBox(
title = "intro",
id= "ttabs", width = 8, height = "420px",
tabPanel("Files", dataTableOutput("Files")),
conditionalPanel(
condition = "input.moreTabs == 'moretabs'",
tabPanel("Files1", dataTableOutput("Files1"))
)
)
)
)
)
server <- function(input, output) { }
shinyApp(ui, server)
However, I am not successful to use the tab panel dynamically. It shows only one tab, and on checking, its supposed to show the second tab.
See Question&Answers more detail:os