Skip to content

bslib v0.5.0

Compare
Choose a tag to compare
@cpsievert cpsievert released this 07 Jun 22:14
· 309 commits to main since this release

This significant release focuses on making dashboards with filling/responsive layouts easier. See the new Getting Started with Dashboards article to learn more. It also includes new components (accordion()) as well as many improvements and bug fixes for existing features and components.

{bslib}'s dashboarding features are still experimental at this point, but this release represents a significant step towards being our recommended way to create Shiny dashboards.

Breaking changes / improvements

  • card_body() now provides the same behavior as card_body_fill() (i.e., it is both a fillable container and fill item) by default. And, now, since card_body() can do everything card_body_fill() can do, card_body_fill() has been deprecated. The main benefit of this change is that card(full_screen = TRUE, ...) with output(s) passed to ... "just works" in an intuitive way. To revert to the previous behavior, set fillable = FALSE and fill = FALSE in calls to card_body() and set wrapper = function(x) card_body(x, fillable = FALSE, fill = FALSE) in calls to card(). (#498)
  • Closed #375: margin-top is no longer included on header tags that aren't created via pandoc. If this negatively impacts spacing above headers, consider adding a suitable utility class (for example, change shiny::titlePanel("My title") to tagAppendAttributes(titlePanel("My title"), class = "mt-3", .selector = "h2")). (#396)
  • page_fill() (now called page_fillable()) had several breaking changes (listed below) to better accommodate filling layouts. If this breaks existing behavior, consider using shiny::fillPage(theme = bslib::bs_theme(), ...) instead of page_fill().
    • page_fill() now produces a <body> tag with display:flex (instead of display:block).
    • page_fill() no longer fills the windows height on mobile (i.e., narrow screens) by default (set fillable_mobile = TRUE to restore the old behavior).
    • page_fill() now adds padding and gap by default, set padding = 0 and gap = 0 to restore the old behavior.
  • page_navbar() (and also shiny::navbarPage() with theme = bs_theme()) had a couple breaking changes:
    • The container of each page is now display:flex (instead of display:block). If this breaks existing behavior, set page_navbar()'s fillable argument to FALSE.
    • header and footer is no longer wrapped in an additional shiny::fluidRow() container. If this breaks existing behavior, consider wrapping the header and footer value(s) with shiny::fluidRow()). (#479)
  • layout_column_wrap()'s fill argument now controls whether or not the layout container is allowed to grow/shrink to fit a fillable container (e.g., page_fillable()). It also gains a new fillable argument for controlling whether UI elements are allowed to fill their row height. This is more consistent with the meaning of fill in other functions, like card(), card_body(), layout_sidebar(), etc. (#498)
  • Defaults for the following Bootstrap 5 Sass variables were changed to null: $accordion-button-active-bg, $accordion-button-active-color, and $accordion-icon-active-color. To restore the old behavior, do bs_add_variables(theme, "accordion-button-active-bg" = "tint-color($component-active-bg, 90%)", "accordion-button-active-color" = "shade-color($primary, 10%)", "accordion-icon-active-color" = "$accordion-button-active-color", .where = "declarations"). (#475)

New features

  • Added page_sidebar(), for easy dashboard creation. (#588)
  • Added a sidebar() API for creating sidebar layouts in various contexts. See the article to learn more. (#479)
  • Added layout_columns(), for responsive column-based grid layouts. (#587)
  • Adds a new accordion() API. See help(accordion) for examples and details. Note also accordion() is designed to work well inside a sidebar(). (#475)
  • page_navbar(), navset_card_tab(), and navset_card_pill() gain a sidebar argument for putting a sidebar() on every page/tab/pill. (#479)
  • page_navbar() gains a fillable argument to make the content of particular page(s) fit the window/card. (#479)
  • page_fillable() (aka, page_fill()) is now considered a fillable container, meaning that fill items like card(), layout_column_wrap(), and layout_sidebar() now grow/shrink to fit the window's height when they appear as a direct child of page_fillable(). (#479)
  • page_navbar() and page_fillable() gain fillable_mobile arguments to control whether the page should grow/shrink to fit the viewport on mobile. (#479)
  • card(), value_box(), and card_image() gain max_height/min_height and fill arguments. (#498)
  • card_body() gains a padding argument. (#587)
  • Added new as_fill(), as_fillable(), as_fill_carrier(), is_fill(), and is_fillable() for testing and coercing potential to fill. (#498)

Bug fixes

  • Closed #558: nested cards with fullscreen = TRUE now correctly and individually expand to fill the window. Tab focus behavior while in full screen mode has also been improved. (#557)
  • Closed #573: Improved styling when a dynamic result is supplied to value_box()'s title/value (e.g., value_box("Dynamic value", uiOutput("value"))). (#605)

Deprecations

  • card_body_fill() has been deprecated in favor of card_body(). (#498)
  • page_fill() has been deprecated in favor of page_fillable(). (#498)
  • nav() has been deprecated in favor of nav_panel() and nav_content() in favor of nav_panel_hidden(). (#476)
  • The navs_*() family of functions have been deprecated in favor of navset_*() (#476):
    • navs_tab() is now navset_tab()
    • navs_pill() is now navset_pill()
    • navs_pill_list() is now navset_pill_list()
    • navs_bar() is now navset_bar()
    • navs_tab_card() and navs_pill_card() are now navset_card_tab() and navset_card_pill(), respectively.