rstudio / rstudio/bslib

Error when using bslib component in Bootstrap 4 Shiny app

Open
#1,207 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
SCSS
Stars
569
Forks
72
Avg merge
1d 2h
Merged PRs (30d)
5

Description

Describe the problem

Hi,

After upgrading the bslib package to the latest version (0.9.0), our app throws an error when I try to specify Bootstrap v4 in Shiny UI and use a bslib component like nav_spacer.
The error message is: 'Error in component_dependency_sass: bslib components require Bootstrap 5 or higher.'

However, it did work before we upgraded the bslib package (when it was version 0.5.1).

I'm wondering if the latest bslib package no longer supports older Bootstrap versions or it's a compatibility issue?

Here is a simple example code:

library(shiny)
library(bslib)

ui <- fluidPage(
  
  theme = bslib::bs_theme(version = 4),
  
  shiny::navbarPage(
    title = "Example",
    shiny::tabPanel(
      title = "Tab 1",
      value = "tab1"
    ),
    bslib::nav_spacer(),
    shiny::tabPanel(
      title = "Tab 2",
      value = "tab2"
    )
  )
)

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

shinyApp(ui, server)
Session Info

Place your devtools::session_info() here

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the minimal R example with bslib 0.9.0 and inspect the Bootstrap-version handling reached by nav_spacer() and component_dependency_sass. Compare the behavior with bslib 0.5.1; done means the compatibility behavior is corrected or the supported Bootstrap versions are clearly documented and covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
bootstrap, r
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.