showTab not displaying contents properly with bslib
Nobody has claimed this yet.
- Dominant language
- SCSS
- Stars
- 569
- Forks
- 72
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 5
Description
Describe the problem
I'm running into an issue where bslib is not displaying the contents of a tab with showTab() when "base" shiny is working fine.
Here's an example of a "base" shiny that works as desired:
library(shiny)
library(bslib)
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
checkboxGroupInput("create_tabs", label = "Select an option to create a tab",
choices = c("Letters", "Numbers", "Symbols")),
tabsetPanel(id = "Options",
tabPanel("Letters", checkboxGroupInput("Letter_options", label = "Letter options",
choices = LETTERS[1:5])),
tabPanel("Numbers", checkboxGroupInput("Number_options", label = "Number options",
choices = 1:5)),
tabPanel("Symbols", checkboxGroupInput("Symbol_options", label = "Symbol options",
choices = c("$", "#", "&", "!", "?")))
)
),
mainPanel()
)
)
server <- function(input, output, session) {
observe({
if ("Letters" %in% input$create_tabs) {
showTab("Options", target = "Letters", select = TRUE)
} else {
hideTab("Options", target = "Letters")
}
if ("Numbers" %in% input$create_tabs) {
showTab("Options", target = "Numbers", select = TRUE)
} else {
hideTab("Options", target = "Numbers")
}
if ("Symbols" %in% input$create_tabs) {
showTab("Options", target = "Symbols", select = TRUE)
} else {
hideTab("Options", target = "Symbols")
}
})
}
shinyApp(ui, server)
See this gif of the app working as desired: https://i.imgur.com/qJMMtwb.mp4
However, if I implement bslib using the following code:
ui <- page_sidebar(
sidebar = sidebar(
checkboxGroupInput("create_tabs", label = "Select an option to create a tab",
choices = c("Letters", "Numbers", "Symbols")),
tabsetPanel(id = "Options",
tabPanel("Letters", checkboxGroupInput("Letter_options", label = "Letter options",
choices = LETTERS[1:5])),
tabPanel("Numbers", checkboxGroupInput("Number_options", label = "Number options",
choices = 1:5)),
tabPanel("Symbols", checkboxGroupInput("Symbol_options", label = "Symbol options",
choices = c("$", "#", "&", "!", "?")))
)
),
card()
)
Now when I select a tab to open, the contents do not show: https://i.imgur.com/R74cENE.gif
Session Info
version R version 4.5.2 (2025-10-31 ucrt)
os Windows 11 x64 (build 26200)
system x86_64, mingw32
ui RStudio
language (EN)
package * version date (UTC) lib source
bslib * 0.9.0.9002 2025-11-21 [1] Github (rstudio/bslib@0757592)
shiny * 1.11.1 2025-07-03 [1] CRAN (R 4.5.2)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided reproduction using page_sidebar(), tabsetPanel(), showTab(), and hideTab(), then compare its behavior with the working base Shiny example. Trace why selecting a tab under bslib leaves its contents hidden; done means the tab contents display correctly when tabs are shown and the reproduction works without changing the base Shiny behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100