Conditional tabBox with shinydashboard



Hello all,

I am using shinydashboard and I am trying to condition the tabs on the tabBox function based on the user choices (for example if the user select option 1 then open tab1, tab2 and tab4 otherwise open tab3 and tab4). I tried to use the conditionalPanel function however it shift the tab outside the tabBox. Any suggestion how to do it?

Thank you in advance!


It’s not an elegant solution, but could you put each tab inside conditionalPanel()? Something like:

    conditionalPanel([some condition], tabPanel([content of tab])),
    conditionalPanel([some other condition], tabPanel([content of tab]))

Alternatively if you just want to have a different tab selected each time a user changes an option (rather than hiding/showing the tabs completely) then it might be worth looking at updateTabsetPanel().


Another way could be to create the tabs on the fly using insertTab() or appendTab(): . Here’s an example of using appendTab() when the user clicks on an Airport row in the lower right plot: and here’s the Gist for it:


Thank you for the answers!