Is there a simple solution to making tab panels within the main tab panels created in R shiny?
Here is how I create the main panels:
mainPanel(
  tabsetPanel(id = "tabSelected",
    tabPanel("Tab1", uiOutput("Tab1")),
    tabPanel("Tab2", uiOutput("Tab2"))
I wanted to make new tabs within "Tab1" for various plots I would like to show. I attempted to nest the tabsetPanel function but that doesn't work. Thanks!
A TabSet is comprised of many TabStops. It offers methods for locating the closest TabStop to a given position and finding all the potential TabStops. It is also immutable.
Tab Panels Tabsets are created by calling the tabsetPanel function with a list of tabs created by the tabPanel function. Each tab panel is provided a list of output elements which are rendered vertically within the tab.
Maybe because yforget to include them into a new sub-tabsetPanel ?
This works for me :
shiny::runApp(list(
  ui = bootstrapPage(
    tabsetPanel(id = "tabSelected",
      tabPanel("Tab1", uiOutput("Tab1")),
      tabPanel("Tab2", uiOutput("Tab2"))
    )
  ),
  server = function(input, output,session) {
    output$Tab1 <- renderUI({
      tabsetPanel(id = "subTabPanel1", 
        tabPanel("subTab11"),
        tabPanel("subTab12")
      )
    })
    output$Tab2 <- renderUI({
      tabsetPanel(id = "subTabPanel2", 
                  tabPanel("subTab21"),
                  tabPanel("subTab22")
      )
    })
  }
))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With