bslib 0.5.0
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 ascard_body_fill()
(i.e., it is both a fillable container and fill item) by default. And, now, sincecard_body()
can do everythingcard_body_fill()
can do,card_body_fill()
has been deprecated. The main benefit of this change is thatcard(full_screen = TRUE, ...)
with output(s) passed to...
“just works” in an intuitive way. To revert to the previous behavior, setfillable = FALSE
andfill = FALSE
in calls tocard_body()
and setwrapper = function(x) card_body(x, fillable = FALSE, fill = FALSE)
in calls tocard()
. (#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, changeshiny::titlePanel("My title")
totagAppendAttributes(titlePanel("My title"), class = "mt-3", .selector = "h2")
). (#396) -
page_fill()
(now calledpage_fillable()
) had several breaking changes (listed below) to better accommodate filling layouts. If this breaks existing behavior, consider usingshiny::fillPage(theme = bslib::bs_theme(), ...)
instead ofpage_fill()
.-
page_fill()
now produces a<body>
tag withdisplay:flex
(instead ofdisplay:block
). -
page_fill()
no longer fills the windows height on mobile (i.e., narrow screens) by default (setfillable_mobile = TRUE
to restore the old behavior). -
page_fill()
now addspadding
andgap
by default, setpadding = 0
andgap = 0
to restore the old behavior.
-
-
page_navbar()
(and alsoshiny::navbarPage()
withtheme = bs_theme()
) had a couple breaking changes:- The container of each page is now
display:flex
(instead ofdisplay:block
). If this breaks existing behavior, setpage_navbar()
’sfillable
argument toFALSE
. -
header
andfooter
is no longer wrapped in an additionalshiny::fluidRow()
container. If this breaks existing behavior, consider wrapping theheader
andfooter
value(s) withshiny::fluidRow()
). (#479)
- The container of each page is now
-
layout_column_wrap()
’sfill
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 newfillable
argument for controlling whether UI elements are allowed to fill their row height. This is more consistent with the meaning offill
in other functions, likecard()
,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, dobs_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. Seehelp(accordion)
for examples and details. Note alsoaccordion()
is designed to work well inside asidebar()
. (#475) -
page_navbar()
,navset_card_tab()
, andnavset_card_pill()
gain asidebar
argument for putting asidebar()
on every page/tab/pill. (#479) -
page_navbar()
gains afillable
argument to make the content of particular page(s) fit the window/card. (#479) -
page_fillable()
(aka,page_fill()
) is now considered afillable
container, meaning thatfill
items likecard()
,layout_column_wrap()
, andlayout_sidebar()
now grow/shrink to fit the window’s height when they appear as a direct child ofpage_fillable()
. (#479) -
page_navbar()
andpage_fillable()
gainfillable_mobile
arguments to control whether the page should grow/shrink to fit the viewport on mobile. (#479) -
card()
,value_box()
, andcard_image()
gainmax_height
/min_height
andfill
arguments. (#498) -
card_body()
gains apadding
argument. (#587) - Added new
as_fill()
,as_fillable()
,as_fill_carrier()
,is_fill()
, andis_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()
’stitle
/value
(e.g.,value_box("Dynamic value", uiOutput("value"))
). (#605)
Deprecations
-
card_body_fill()
has been deprecated in favor ofcard_body()
. (#498) -
page_fill()
has been deprecated in favor ofpage_fillable()
. (#498) -
nav()
has been deprecated in favor ofnav_panel()
andnav_content()
in favor ofnav_panel_hidden()
. (#476) - The
navs_*()
family of functions have been deprecated in favor ofnavset_*()
(#476):-
navs_tab()
is nownavset_tab()
-
navs_pill()
is nownavset_pill()
-
navs_pill_list()
is nownavset_pill_list()
-
navs_bar()
is nownavset_bar()
-
navs_tab_card()
andnavs_pill_card()
are nownavset_card_tab()
andnavset_card_pill()
, respectively.
-
bslib 0.4.2
CRAN release: 2022-12-16
New features
-
Adds a new
card()
API as well asvalue_box()
andlayout_column_wrap()
. To learn more about this new functionality, refer to these new pkgdown articles:
bslib 0.4.0
CRAN release: 2022-07-16
Breaking changes
-
bs_theme()
now defaults toversion = 5
(i.e., Bootstrap 5). If this change happens to break an existing app, consider specifyingbs_theme(version = 4)
to revert the change in the Bootstrap version. (#374) - The default coloring on some Bootswatch 4+ theme’s
.navbar-default
/.navbar-inverse
class has changed slightly to better match their Bootswatch 3 coloring. Also, since this coloring is now based solely on$navbar-*
variables, Bootswatch themes now work better in combination with custom$navbar-*
values (e.g.,bs_theme("navbar-bg" = ...)
can be used to provide the background color, and foreground colors will automatically contrast appropriately). (#392)
New features
- Upgraded Bootstrap 5 (i.e.,
bs_theme(version = 5)
) from 5.1.0 to 5.1.3 (#378) - Closed #369:
bs_dependency_defer()
now memoisesfunc
(by default), reducing the time required to render multiple instances of the same dynamically themable widget. (#405)
Bug fixes
- Closed #393: Bootstrap 5’s
$form-check-label-*
variables now work as expected withshiny::radioButtons()
,shiny::checkboxInput()
, andshiny::checkboxGroupInput()
. (#395) - Closed #382: Various fixes for using
shiny::checkboxInput()
,shiny::checkboxGroupInput()
, andshiny::radioButton()
withbs_theme(version = 5, bootswatch = "sketchy")
. (#385) - Closed #377: make sure
shiny::tabsetPanel(type = "hidden")
(i.e.,bslib::navs_hidden()
) stays hidden when used withbs_theme()
. (#379) - Closed #424: fixed an issue with
nav_menu()
appearing first in anavs_*()
container with Bootstrap 4+. - Closed #431: Bootstrap 5 navbars no longer have an unwanted “Toggle Navigation” label when collapsed. (#432)
- Closed #400:
nav_menu(align="right")
now works with Bootstrap 5. (#401) - Closed #390: using
bs_theme(bootswatch = "paper", version = 5)
orbs_theme(bootswatch = "readable", version = 5)
no longer errors. (#391)
bslib 0.3.1
CRAN release: 2021-10-06
New features
- Upgraded Bootstrap 5 (i.e.,
bs_theme(version = 5)
) from 5.0.2 to 5.1.0 (#365)
Bug fixes
- Closed rstudio/shiny#3519:
nav_menu()
(i.e.,shiny::navbarMenu()
) wasn’t producing an.active
class on it’s.dropdown
container properly. (#372)
bslib 0.3.0
CRAN release: 2021-09-02
Breaking changes
- Closed rstudio/rmarkdown#2154: magrittr’s pipe operator (
%>%
) is no longer re-exported by bslib. Eitherlibrary(magrittr)
to make%>%
available and/or use use R 4.1’s pipe operator (|>
).
New features
- Closed #82: Added support for Bootstrap 5 (via
bs_theme(version = 5)
). Bootstrap 4 remains the default in this release, but the next release, the default will likely change to Bootstrap 5.
bslib 0.2.5
CRAN release: 2021-05-12
New features and improvements
- Closed #251: New
bs_theme()
options (navbar-bg
,navbar-light-bg
, andnavbar-dark-bg
) for more easily customizing the navbar’s background (and foreground) color (#253, #271). - Closed #281: New
bs_theme()
argument (font_scale
) for easier scaling of the base font size (#288). - Closed #256 and #282: Font file importers (
font_google()
,font_link()
, andfont_face()
) are now re-exported from the sass package. As a result, they may now be used with any Sass variable (e.g.,bs_theme("input-font-family" = font_google("Pacifico"))
) as well as inside Rmd yaml without!expr
(e.g.,input-font-family: google: Pacifico
– see #256 for more details). A newfont_collection()
function was also added for a more convenient way to specify font fallbacks (#291). - Closed #255:
bs_themer()
now emits sensibleyaml
front matter when used within an Rmd document (#288). - Closed #227:
bs_themer()
now overlays a spinner during Sass compilation (#243). - Closed #278: bslib now includes
rmarkdown::html_document
templates demonstrating example usage with bslib and thematic (#288). - Closed #231: Upgraded from Bootstrap 4.5.3 to 4.6.0 (#254).
- Closed #237:
<blockquote>
tags now have border-left/padding styles withversion = 4
(to mirror theversion = 3
behavior) (#239). - Closed #279: Warnings about low color contrasts are now suppressed by default, unless
shiny::devmode()
is enabled. To enable/disable these warnings, set the newoptions(bslib.color_contrast_warnings = )
toTRUE
/FALSE
(#287). -
bs_theme_dependencies()
now includes Sass source maps whenshiny::devmode()
is enabled (#312). - Added new
bs_add_functions()
/bs_add_mixins()
and deprecatedbs_add_declarations()
to reflectsass::sass_layer()
’s new ability to placefunctions
before variabledefaults
. As a result, variable definitions may now use functions defined withbs_add_functions()
. (#311)
bslib 0.2.4
CRAN release: 2021-01-25
- Initial release of the package, see https://rstudio.github.io/bslib/