Skip to content

Commit 0187112

Browse files
committed
Remove --font-size-base in favor of --body-font-size
The token was only referenced by a handful of components as an indirect fallback and had no corresponding entry in _root.scss, making it effectively dead and impossible to override. Point those fallbacks at --body-font-size instead and document the removal in the migration guide. Fixes #42624
1 parent aa58212 commit 0187112

5 files changed

Lines changed: 7 additions & 6 deletions

File tree

scss/_accordion.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ $accordion-tokens: defaults(
4444
align-items: center;
4545
width: 100%;
4646
padding: var(--accordion-btn-padding-y, var(--accordion-padding-y)) var(--accordion-btn-padding-x, var(--accordion-padding-x));
47-
font-size: var(--accordion-font-size, var(--font-size-base));
47+
font-size: var(--accordion-font-size, var(--body-font-size));
4848
color: var(--accordion-btn-color);
4949
text-align: start;
5050
list-style: none; // Remove default marker
@@ -147,7 +147,7 @@ $accordion-tokens: defaults(
147147

148148
.accordion-body {
149149
padding: var(--accordion-body-padding-y, var(--accordion-padding-y)) var(--accordion-body-padding-x, var(--accordion-padding-x));
150-
font-size: var(--accordion-font-size, var(--font-size-base));
150+
font-size: var(--accordion-font-size, var(--body-font-size));
151151
}
152152

153153

scss/_root.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $root-tokens: defaults(
2121

2222
// scss-docs-start root-body-variables
2323
--body-font-family: system-ui,
24-
--body-font-size: var(--font-size-base),
24+
--body-font-size: 1rem,
2525
--body-font-weight: var(--font-weight-normal),
2626
--body-line-height: var(--line-height-base),
2727

@@ -76,7 +76,7 @@ $root-tokens: defaults(
7676
--btn-input-min-height: 2.375rem,
7777
--btn-input-padding-y: .375rem,
7878
--btn-input-padding-x: .75rem,
79-
--btn-input-font-size: var(--font-size-base),
79+
--btn-input-font-size: var(--body-font-size),
8080
--btn-input-line-height: var(--line-height-base),
8181
--btn-input-border-radius: var(--radius-5),
8282

site/src/content/docs/content/typography.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Bootstrap sets basic global display, typography, and link styles. When more cont
1515
- Set the global link color via `--bs-link-color`.
1616
- Use `--bs-body-bg` to set a `background-color` on the `<body>` (`#fff` by default).
1717

18-
These styles can be found within `_reboot.scss`, and the global variables are defined in `_config.scss`. Make sure to set `--font-size-base` in `rem`.
18+
These styles can be found within `_reboot.scss`, and the global variables are defined in `_config.scss`. Make sure to set `--body-font-size` in `rem`.
1919

2020
## Headings
2121

site/src/content/docs/guides/migration.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ Bootstrap 6 is a major release with many breaking changes to modernize our codeb
302302
- Relocated heading classes (like `.h1`) and some type classes (`.mark`, `.small`, and `.initialism`) to Reboot from `_type.scss`. This avoids a dependency in Sass modules and we like to avoid extending selectors in general.
303303
- **Split the remaining `_type.scss` into `_lists.scss` and `_blockquote.scss`.** Update any individual `@use "bootstrap/scss/content/type"` imports to `content/lists` and/or `content/blockquote` instead.
304304
- **Headings, paragraphs, description lists, and `<legend>` now use CSS variables instead of Sass variables.** Removed `$headings-margin-bottom`, `$headings-font-family`, `$headings-font-style`, `$headings-font-weight`, `$headings-line-height`, `$headings-color`, `$paragraph-margin-bottom`, `$legend-margin-bottom`, `$legend-font-size`, `$legend-font-weight`, and `$dt-font-weight`. Customize the equivalent `--heading-*`, `--paragraph-margin-bottom`, and `--legend-*` CSS variables at runtime instead—see [Typography]([[docsref:/content/typography]]).
305+
- **Removed `$font-size-base` and `--font-size-base`.** The base body font size is now set directly via `--body-font-size` (default `1rem`) in `_root.scss`. Any component tokens that previously fell back to `var(--font-size-base)` (like the accordion) now fall back to `var(--body-font-size)` instead. Update custom Sass or CSS that referenced either variable to use `--body-font-size`.
305306
- Heading and `<dt>` font-weight now fall back to shared weight tokens (`font-weight: var(--heading-font-weight, var(--font-weight-medium))`, `var(--dt-font-weight, var(--font-weight-bold))`) instead of a hardcoded value, so you can override either the component-specific token or the shared one.
306307
- Added `--link-underline-offset` to `$root-tokens` (mirroring `$link-underline-offset`) for runtime customization of the link underline offset.
307308
- Reboot and content spacing—`address`, lists, `dd`, `blockquote`, `pre`, `figure`, `caption`, `kbd` padding, and `ol`/`ul` `padding-inline-start` (now driven by a new `--list-padding-x` token)—now derive from the `--spacer-*` scale instead of hardcoded `rem` values. Visual output is unchanged.

site/src/scss/_component-examples.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
position: relative;
5555
display: flow-root;
5656
padding: var(--bd-example-padding);
57-
font-size: var(--font-size-base);
57+
font-size: var(--body-font-size);
5858
line-height: var(--body-line-height);
5959
background-color: var(--bs-bg-body);
6060

0 commit comments

Comments
 (0)