'Nested Tabsets in Shiny?
How can I create nested tabs in RShiny like the image below?
Where "Sales Performance" is the parent tab and "Open Quotes - LW" is the sub tab that rolls up under the "Sales Performance Tab"
I have a reproducible example using the iris dataset
library(shiny)
library(DT)
ui <- fluidPage(
titlePanel("Tabsets"),
sidebarLayout(
sidebarPanel(
textInput('search', "Search"),
),
mainPanel(
tabsetPanel(id = "tabsetPanelID",
type = "tabs",
tabPanel("Tab1", DTOutput('DT1')),
tabPanel("Tab2", DTOutput('DT2')),
tabPanel("Tab3", DTOutput('DT3'))
)
)
)
)
server <- function(input, output, session) {
output$DT1 = renderDT(iris)
DTProxy1 <- dataTableProxy("DT1")
output$DT2 = renderDT(iris)
DTProxy2 <- dataTableProxy("DT2")
output$DT3 = renderDT(iris)
DTProxy3 <- dataTableProxy("DT3")
observeEvent(c(input$search, input$tabsetPanelID), {
updateSearch(DTProxy1, keywords = list(global = input$search, columns = NULL))
updateSearch(DTProxy2, keywords = list(global = input$search, columns = NULL))
updateSearch(DTProxy3, keywords = list(global = input$search, columns = NULL))
})
}
shinyApp(ui, server)
What I currently have looks like the following:
Solution 1:[1]
You could add another tabsetPanel into each tabPanel of the main tabsetPanel.
mainPanel(tabsetPanel(
id = "tabsetPanelID",
type = "tabs",
tabPanel("Tab1", tabsetPanel(
tabPanel("SubPanelA1"), tabPanel("SubPanelA2")
)),
tabPanel("Tab2", tabsetPanel(
tabPanel("SubPanelB1"), tabPanel("SubPanelB2")
)),
tabPanel("Tab3", tabsetPanel(
tabPanel("SubPanelC1"), tabPanel("SubPanelC2")
))
))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |


