Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b29e013
Updating card scss
elnelson575 Nov 6, 2025
b9aadd9
Updated news
elnelson575 Nov 6, 2025
8b65e50
Pulling out unnecessary card class change
elnelson575 Nov 6, 2025
9608000
Revert "Pulling out unnecessary card class change"
elnelson575 Nov 6, 2025
5316914
Resave distributed files (GitHub Action)
elnelson575 Nov 6, 2025
36859af
Resave data (GitHub Action)
elnelson575 Nov 6, 2025
9e9c618
Update inst/components/scss/card.scss
elnelson575 Nov 7, 2025
157354a
`devtools::document()` (GitHub Actions)
elnelson575 Nov 7, 2025
ace1e42
Updates based on comments
elnelson575 Nov 7, 2025
31bbcf2
Merge branch 'feat/card-header-flex' of https://github.com/rstudio/bs…
elnelson575 Nov 7, 2025
aa882a0
adding doc changes
elnelson575 Nov 7, 2025
d706a1e
undoing doc changes
elnelson575 Nov 7, 2025
420adb3
Resave distributed files (GitHub Action)
elnelson575 Nov 7, 2025
7495e7f
Update NEWS.md
elnelson575 Nov 7, 2025
82e596e
Update inst/components/scss/card.scss
elnelson575 Nov 7, 2025
0927eec
Update NEWS.md
elnelson575 Nov 7, 2025
8d0241f
Fix behavior with nav
elnelson575 Nov 7, 2025
5e93e6f
Merge branch 'feat/card-header-flex' of https://github.com/rstudio/bs…
elnelson575 Nov 7, 2025
c07d1a6
Resave distributed files (GitHub Action)
elnelson575 Nov 7, 2025
3379a8f
nav_spacer works in card_header navs but not card_headers vanilla
elnelson575 Nov 10, 2025
51ca2d6
erge branch 'feat/card-header-flex' of https://github.com/rstudio/bsl…
elnelson575 Nov 10, 2025
ceac762
Resave distributed files (GitHub Action)
elnelson575 Nov 10, 2025
be74e38
Docs change
elnelson575 Nov 10, 2025
5420d50
Merge branch 'feat/card-header-flex' of https://github.com/rstudio/bs…
elnelson575 Nov 10, 2025
c7494cf
`devtools::document()` (GitHub Actions)
elnelson575 Nov 10, 2025
94bcc09
Updating nav scss
elnelson575 Nov 10, 2025
f5a33af
Merge branch 'feat/card-header-flex' of https://github.com/rstudio/bs…
elnelson575 Nov 10, 2025
fbb1dbf
Resave distributed files (GitHub Action)
elnelson575 Nov 10, 2025
cbb090f
Fixed nav_spacer
elnelson575 Nov 10, 2025
c3a6cb3
Merge branch 'feat/card-header-flex' of https://github.com/rstudio/bs…
elnelson575 Nov 10, 2025
4e30094
Resave distributed files (GitHub Action)
elnelson575 Nov 10, 2025
6883d5d
Spacing
elnelson575 Nov 10, 2025
fbc70e3
Merge branch 'feat/card-header-flex' of https://github.com/rstudio/bs…
elnelson575 Nov 10, 2025
11b0823
Undoing unnecessary change
elnelson575 Nov 10, 2025
e5a433a
`devtools::document()` (GitHub Actions)
elnelson575 Nov 10, 2025
528c2d2
Resave distributed files (GitHub Action)
elnelson575 Nov 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

## Improvements and bug fixes

* `card_header()` is now flex by default and gains a `gap` argument to better support complex header layouts. (#1253)

* `bs_theme_dependencies()` now avoids unnecessarily copying internal package files to R's temporary directory more than once when preparing precompiled theme dependencies (e.g. for a standard `bs_theme()` theme). (#1184)

* Fixed an issue where the `<main>` areas of `page_sidebar()` and `page_navbar()` (with a `sidebar`) were made to be a fillable containers even when `fillable = FALSE`. (#1188)
Expand Down
14 changes: 12 additions & 2 deletions R/card.R
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,19 @@ card_title <- function(..., container = htmltools::h5) {
#' @describeIn card_body A header (with border and background color) for the `card()`. Typically appears before a `card_body()`.
#' @param container a function that generates an [htmltools tag][htmltools::tags].
#' @export
card_header <- function(..., class = NULL, container = htmltools::div) {
card_header <- function(
...,
gap = NULL,
class = NULL,
container = htmltools::div
) {
as.card_item(
container(class = "card-header", class = class, ...)
container(
class = "card-header bslib-gap-spacing",
class = class,
style = css(gap = validateCssUnit(gap)),
...
)
)
}

Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion inst/components/dist/components.css

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions inst/components/scss/card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@
}

.card-header {
display: flex;
flex-direction: row;
align-items: center;
align-self: stretch;
gap: 0.25rem;

// Only give the nav flex: 1 if it contains a nav_spacer so that it properly pushes items
// to the right. If there is no nav_spacer, we want it the nav to flex with other items
// in the header naturally.
> .nav:has(.bslib-nav-spacer) {
flex: 1;
min-width: 0; // Prevent flex item from overflowing
}

.form-group {
margin-bottom: 0;
}
Expand Down
6 changes: 5 additions & 1 deletion inst/components/scss/nav_spacer.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/* CSS behind nav_spacer() */

@mixin nav-spacer() {
.nav:not(.nav-hidden) {

.nav:not(.nav-hidden),
.card-header {
/* Make sure nav container is flexbox (they aren't in BS3) */
display: flex !important;
display: -webkit-flex !important;
Expand Down Expand Up @@ -28,6 +31,7 @@
}
}


/* BS4+ uses this mixin for configurable breakpoints */
@if mixin-exists("media-breakpoint-up") {
@include media-breakpoint-up(sm) {
Expand Down
2 changes: 1 addition & 1 deletion man/card_body.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/_snaps/card.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"https://example.com/image.jpg"), card_body("image not a cap")))
Output
<div class="card bslib-card bslib-mb-spacing html-fill-item html-fill-container" data-bslib-card-init data-require-bs-caller="card()" data-require-bs-version="5">
<div class="card-header">header</div>
<div class="card-header bslib-gap-spacing">header</div>
<img src="https://example.com/image.jpg" alt="" class="img-fluid"/>
<div class="card-body bslib-gap-spacing html-fill-item html-fill-container" style="margin-top:auto;margin-bottom:auto;flex:1 1 auto;">image not a cap</div>
<script data-bslib-card-init>bslib.Card.initializeAllCards();</script>
Expand Down