Different sidebar panel for groups of tabs


#1

Hello all,

I have a question about having a different sidebar panel for groups of tabs not just a different sidebar panel for each tab. This is what I've tried so far. The side bar panel is the same for the first 2 tabs but the 3rd tab that I want a different sidebar panel for does not appear.
Any suggestions?
Thank you in advance

library(shiny)
library(tidyverse)

ui <- fluidPage(fluid = TRUE,
                ,
                  mainPanel(
                    tabsetPanel(
                      sidebarLayout(
                        sidebarPanel(
                          selectInput("tt", "TT:", c("2","3"), selected = "2")
                        ),
                      tabPanel("Plots"),
                      tabPanel("Test Panel")
                                 ))),
                mainPanel(
                tabsetPanel(
tabPanel("UU"))
                )

server <- function(input, output, session){
  
}

shinyApp(ui,server)

#2

You might be best served doing this on the server side, e.g. build your UI logic in the server function, depending on which tab is currently selected in the UI (if I remember correctly there is a way to identify the currently selected tab). Alternatively, you may be able to build a Shiny module to contain the various bits of UI/associated server logic you want and use that instead.


closed #4

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.