diff --git a/NEWS.md b/NEWS.md index 9ee177f07..5afb7ea51 100644 --- a/NEWS.md +++ b/NEWS.md @@ -20,6 +20,8 @@ * The main content area of `page_sidebar()` and `page_navbar()` with a `sidebar` now have a minimum height and width to avoid squashed content in fillable layouts. The minimum height and width are controllable via Sass and CSS variables (see the pull requests for details). (#1057, #1059) +* When `card_body(fillable = FALSE)`, bslib now preserves flow-layout margin bottom settings. (#1073) + # bslib 0.7.0 This large release includes many improvements and bug fixes for newer UI components like `layout_columns()`, `card()`, and `sidebar()`. In addition, the new `input_task_button()` offers a drop-in replacement for `shiny::actionButton()` (to prevent multiple submissions of the same operation) as well as pairing nicely with the new `shiny::ExtendedTask` for implementing truly non-blocking operations in Shiny. diff --git a/R/card.R b/R/card.R index 39da272fd..e782c738f 100644 --- a/R/card.R +++ b/R/card.R @@ -197,7 +197,8 @@ card_body <- function(..., fillable = TRUE, min_height = NULL, max_height = NULL } tag <- div( - class = "card-body bslib-gap-spacing", + class = "card-body", + class = if (fillable) "bslib-gap-spacing", style = css( min_height = validateCssUnit(min_height), "--bslib-card-body-max-height" = validateCssUnit(max_height), diff --git a/R/layout.R b/R/layout.R index 1e9c0fa5f..c85c067e9 100644 --- a/R/layout.R +++ b/R/layout.R @@ -389,7 +389,8 @@ row_heights_css_vars <- function(x) { grid_item_container <- function(el, ..., fillable = TRUE) { div( ..., - class = "bslib-grid-item bslib-gap-spacing", + class = "bslib-grid-item", + class = if (fillable) "bslib-gap-spacing", if (fillable) as_fillable_container(), el ) diff --git a/tests/testthat/_snaps/layout.md b/tests/testthat/_snaps/layout.md index 90ac78a0f..c1bd61cc2 100644 --- a/tests/testthat/_snaps/layout.md +++ b/tests/testthat/_snaps/layout.md @@ -92,7 +92,7 @@ Code grid_item_container(div(class = "layout-column-child-element"), fillable = FALSE) Output -