]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Rename `$grid-breakpoints` to `$breakpoints`, add to root tokens (#42124)
authorMark Otto <markd.otto@gmail.com>
Sun, 8 Mar 2026 00:34:09 +0000 (16:34 -0800)
committerGitHub <noreply@github.com>
Sun, 8 Mar 2026 00:34:09 +0000 (16:34 -0800)
* Rename breakpoints var, output to root

* fixes

20 files changed:
js/src/util/floating-ui.js
scss/_config.scss
scss/_dialog.scss
scss/_list-group.scss
scss/_navbar.scss
scss/_root.scss
scss/_stepper.scss
scss/bootstrap-grid.scss
scss/content/_tables.scss
scss/helpers/_position.scss
scss/layout/_breakpoints.scss
scss/layout/_containers.scss
scss/layout/_grid.scss
scss/mixins/_grid.scss
scss/tests/utilities/_api.test.scss
scss/utilities/_api.scss
site/src/content/docs/components/navbar.mdx
site/src/content/docs/customize/components.mdx
site/src/content/docs/layout/breakpoints.mdx
site/src/content/docs/layout/grid.mdx

index 39527dab6a33e7144297a72e06af9629be160ea8..37ce24ee91454244a9daa25f6506f6d59db560b0 100644 (file)
@@ -8,7 +8,7 @@
 import { isRTL } from './index.js'
 
 /**
- * Breakpoints for responsive placement (matches SCSS $grid-breakpoints)
+ * Breakpoints for responsive placement (matches SCSS $breakpoints)
  */
 export const BREAKPOINTS = {
   sm: 576,
index 95d496d0def4b720e08727d3a31c3d3c3eea0866..626d3089c15bf2048bb373d5b9eb6313f2af3b72 100644 (file)
@@ -56,13 +56,13 @@ $sizes: (
   12: calc($spacer * 12),
 ) !default;
 
-// Grid breakpoints
+// Breakpoints
 //
 // Define the minimum dimensions at which your layout will change,
 // adapting to different screen sizes, for use in media queries.
 
-// scss-docs-start grid-breakpoints
-$grid-breakpoints: (
+// scss-docs-start breakpoints
+$breakpoints: (
   xs: 0,
   sm: 576px,
   md: 768px,
@@ -70,10 +70,10 @@ $grid-breakpoints: (
   xl: 1280px,
   2xl: 1536px
 ) !default;
-// scss-docs-end grid-breakpoints
+// scss-docs-end breakpoints
 
-// @include _assert-ascending($grid-breakpoints, "$grid-breakpoints");
-// @include _assert-starts-at-zero($grid-breakpoints, "$grid-breakpoints");
+// @include _assert-ascending($breakpoints, "$breakpoints");
+// @include _assert-starts-at-zero($breakpoints, "$breakpoints");
 
 // Grid columns
 //
index 56e3a6243bffc5e37c99b880a834a8caf6ba819f..b5bd2f1951daecdcfd533a5921eb17f46fb5985e 100644 (file)
@@ -180,8 +180,8 @@ $dialog-sizes: defaults(
   }
 
   // Responsive fullscreen dialogs
-  @each $breakpoint in map.keys($grid-breakpoints) {
-    $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
+  @each $breakpoint in map.keys($breakpoints) {
+    $infix: breakpoint-infix($breakpoint, $breakpoints);
     // stylelint-disable-next-line scss/at-function-named-arguments
     $postfix: if(sass($infix != ""): #{$infix}-down; else: "");
 
index 1d78eadac5fc71c517e2cdce6113abda9b8b6031..2be90c2d33251c8542df324305fce9d381de3bed 100644 (file)
@@ -138,9 +138,9 @@ $list-group-tokens: defaults(
   //
   // Change the layout of list group items from vertical (default) to horizontal.
 
-  @each $breakpoint in map.keys($grid-breakpoints) {
+  @each $breakpoint in map.keys($breakpoints) {
     @include media-breakpoint-up($breakpoint) {
-      $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
+      $infix: breakpoint-infix($breakpoint, $breakpoints);
 
       .list-group-horizontal#{$infix} {
         flex-direction: row;
index 6021764cb2aa9a20686b63a31367b6d2bc5bda5e..697d96df5a5acc70cbd8085edc7acd691ce3948a 100644 (file)
@@ -9,7 +9,7 @@
 // mdo-do: fix nav-link-height and navbar-brand-height, which we previously calculated with font-size, line-height, and block padding
 
 // scss-docs-start navbar-breakpoints
-$navbar-breakpoints: $grid-breakpoints !default;
+$navbar-breakpoints: $breakpoints !default;
 // scss-docs-end navbar-breakpoints
 
 $navbar-tokens: () !default;
index 256e8139def4209733f4cb2ae353376655342fba..221caae814a69056efc7f301b1ae63597d024cef 100644 (file)
@@ -1,9 +1,9 @@
 @use "sass:map";
 @use "colors" as *;
+@use "config" as *;
 @use "functions" as *;
 @use "variables" as *;
 @use "theme" as *;
-// @use "maps" as *;
 @use "mixins/tokens" as *;
 @use "forms/form-variables" as *;
 
@@ -184,6 +184,11 @@ $root-tokens: defaults(
 }
 // scss-docs-end root-theme-tokens
 
+// Generate breakpoint tokens
+@each $name, $value in $breakpoints {
+  $root-tokens: map.set($root-tokens, --breakpoint-#{$name}, $value);
+}
+
 :root {
   @include tokens($root-tokens);
 
index bd2bf4e0faf6d7b462863271389bda644b4c0f86..9ba2921ed22ec6805f830b11e327de6d0d62eff6 100644 (file)
@@ -120,9 +120,9 @@ $stepper-tokens: defaults(
   }
 }
 
-@each $breakpoint in map.keys($grid-breakpoints) {
+@each $breakpoint in map.keys($breakpoints) {
   @include media-breakpoint-up($breakpoint) {
-    $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
+    $infix: breakpoint-infix($breakpoint, $breakpoints);
 
     .stepper-horizontal#{$infix} {
       @include stepper-horizontal();
index 75b291e71b5e494466879539579d01cd392fa4fd..cb71b88127273e133fb4c5cbffd63b4bb7ff0753 100644 (file)
@@ -4,7 +4,6 @@
 
 @use "config" as *;
 @use "functions" as *;
-// @use "maps" as *;
 
 @forward "utilities"; // Make utilities available downstream
 @use "utilities" as *; // Bring utilities into the current namespace
@@ -55,3 +54,9 @@ $utilities: map-get-multiple(
 
 // check-unused-imports-disable-next-line — side-effect import: generates utility CSS.
 @use "utilities/api";
+
+:root {
+  @each $name, $value in $breakpoints {
+    --breakpoint-#{$name}: #{$value};
+  }
+}
index a817ac3a17e42d40c375e764f4282e04eb31255f..29d3de7ed4654fdc34b587d5358ad56cd484b0b7 100644 (file)
@@ -182,8 +182,8 @@ $table-striped-columns-order: even !default;
   // Generate series of `.table-responsive-*` classes for configuring the screen
   // size of where your table will overflow.
 
-  @each $breakpoint in map.keys($grid-breakpoints) {
-    $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
+  @each $breakpoint in map.keys($breakpoints) {
+    $infix: breakpoint-infix($breakpoint, $breakpoints);
 
     @include media-breakpoint-down($breakpoint) {
       .table-responsive#{$infix} {
index ead77a4956fdafd7ff4dfcccee6d35b632fe4844..0a7c9de07d663aa823a397c2ec0f888d8e98c059 100644 (file)
@@ -17,9 +17,9 @@
   }
 
   // Responsive sticky top and bottom
-  @each $breakpoint in map.keys($grid-breakpoints) {
+  @each $breakpoint in map.keys($breakpoints) {
     @include media-breakpoint-up($breakpoint) {
-      $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
+      $infix: breakpoint-infix($breakpoint, $breakpoints);
 
       .sticky#{$infix}-top {
         position: sticky;
index db7323dedbb5cf7194d34a9a9d02c8dee5ade1c3..00f3fc7149cb35b7ed175ac6d18deee4e058b32c 100644 (file)
@@ -8,7 +8,7 @@
 //
 //    (xs: 0, sm: 576px, md: 768px, lg: 1024px, xl: 1280px, 2xl: 1536px)
 //
-// The map defined in the `$grid-breakpoints` global variable is used as the `$breakpoints` argument by default.
+// The map defined in the `$breakpoints` global variable is used as the `$breakpoints` argument by default.
 
 // Name of the next breakpoint, or null for the last breakpoint.
 //
@@ -18,7 +18,7 @@
 //    md
 //    >> breakpoint-next(sm, $breakpoint-names: (xs sm md lg xl 2xl))
 //    md
-@function breakpoint-next($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map.keys($breakpoints)) {
+@function breakpoint-next($name, $breakpoints: $breakpoints, $breakpoint-names: map.keys($breakpoints)) {
   $n: list.index($breakpoint-names, $name);
   @if not $n {
     @error "breakpoint `#{$name}` not found in `#{$breakpoint-names}`";
@@ -35,7 +35,7 @@
 //
 //    >> breakpoint-min(sm, (xs: 0, sm: 576px, md: 768px, lg: 1024px, xl: 1280px, 2xl: 1536px))
 //    576px
-@function breakpoint-min($name, $breakpoints: $grid-breakpoints) {
+@function breakpoint-min($name, $breakpoints: $breakpoints) {
   $min: map.get($breakpoints, $name);
   @return if(sass($min != 0): $min; else: null);
 }
@@ -47,7 +47,7 @@
 //    576px
 //    >> breakpoint-max(xxl, (xs: 0, sm: 576px, md: 768px, lg: 1024px, xl: 1280px, 2xl: 1536px))
 //    null
-@function breakpoint-max($name, $breakpoints: $grid-breakpoints) {
+@function breakpoint-max($name, $breakpoints: $breakpoints) {
   @if $name == null {
     @return null;
   }
@@ -62,7 +62,7 @@
 //    ""  (Returns a blank string)
 //    >> breakpoint-infix(sm, (xs: 0, sm: 576px, md: 768px, lg: 1024px, xl: 1280px, 2xl: 1536px))
 //    "-sm"
-@function breakpoint-infix($name, $breakpoints: $grid-breakpoints) {
+@function breakpoint-infix($name, $breakpoints: $breakpoints) {
   @return if(sass(breakpoint-min($name, $breakpoints) == null): ""; else: "-#{$name}");
 }
 
@@ -71,7 +71,7 @@
 //    @include loop-breakpoints-up() using ($breakpoint, $infix) {
 //      // ...
 //    }
-@mixin loop-breakpoints-up($breakpoints: $grid-breakpoints) {
+@mixin loop-breakpoints-up($breakpoints: $breakpoints) {
   @each $breakpoint in map.keys($breakpoints) {
     $infix: breakpoint-infix($breakpoint, $breakpoints);
     @content($breakpoint, $infix);
@@ -83,7 +83,7 @@
 //    @include loop-breakpoints-down() using ($breakpoint, $next, $infix) {
 //      // ...
 //    }
-@mixin loop-breakpoints-down($breakpoints: $grid-breakpoints) {
+@mixin loop-breakpoints-down($breakpoints: $breakpoints) {
   @each $breakpoint in map.keys($breakpoints) {
     $next: breakpoint-next($breakpoint, $breakpoints);
     $infix: breakpoint-infix($next, $breakpoints);
@@ -92,7 +92,7 @@
 }
 
 // Backwards-compatible alias for next/down breakpoint loops.
-@mixin loop-breakpoints($breakpoints: $grid-breakpoints) {
+@mixin loop-breakpoints($breakpoints: $breakpoints) {
   @include loop-breakpoints-down($breakpoints) using ($breakpoint, $next, $infix) {
     @content($breakpoint, $next, $infix);
   }
 
 // Media of at least the minimum breakpoint width. No query for the smallest breakpoint.
 // Makes the @content apply to the given breakpoint and wider.
-@mixin media-breakpoint-up($name, $breakpoints: $grid-breakpoints) {
+@mixin media-breakpoint-up($name, $breakpoints: $breakpoints) {
   $min: breakpoint-min($name, $breakpoints);
   @if $min {
     @media (width >= $min) {
 
 // Media of at most the maximum breakpoint width. No query for the largest breakpoint.
 // Makes the @content apply to the given breakpoint and narrower.
-@mixin media-breakpoint-down($name, $breakpoints: $grid-breakpoints) {
+@mixin media-breakpoint-down($name, $breakpoints: $breakpoints) {
   $max: breakpoint-max($name, $breakpoints);
   @if $max {
     @media (width < $max) {
 
 // Media that spans multiple breakpoint widths.
 // Makes the @content apply between the min and max breakpoints
-@mixin media-breakpoint-between($lower, $upper, $breakpoints: $grid-breakpoints) {
+@mixin media-breakpoint-between($lower, $upper, $breakpoints: $breakpoints) {
   $min: breakpoint-min($lower, $breakpoints);
   $max: breakpoint-max($upper, $breakpoints);
 
 // Media between the breakpoint's minimum and maximum widths.
 // No minimum for the smallest breakpoint, and no maximum for the largest one.
 // Makes the @content apply only to the given breakpoint, not viewports any wider or narrower.
-@mixin media-breakpoint-only($name, $breakpoints: $grid-breakpoints) {
+@mixin media-breakpoint-only($name, $breakpoints: $breakpoints) {
   $min:  breakpoint-min($name, $breakpoints);
   $next: breakpoint-next($name, $breakpoints);
   $max:  breakpoint-max($next, $breakpoints);
 //    @include container-breakpoint-up(md) { ... }
 //    @include container-breakpoint-up(lg, sidebar) { ... }  // Query named container
 //
-@mixin container-breakpoint-up($name, $container-name: null, $breakpoints: $grid-breakpoints) {
+@mixin container-breakpoint-up($name, $container-name: null, $breakpoints: $breakpoints) {
   $min: breakpoint-min($name, $breakpoints);
   @if $min {
     @if $container-name {
 //    @include container-breakpoint-down(lg) { ... }
 //    @include container-breakpoint-down(lg, sidebar) { ... }  // Query named container
 //
-@mixin container-breakpoint-down($name, $container-name: null, $breakpoints: $grid-breakpoints) {
+@mixin container-breakpoint-down($name, $container-name: null, $breakpoints: $breakpoints) {
   $max: breakpoint-max($name, $breakpoints);
   @if $max {
     @if $container-name {
 //    @include container-breakpoint-between(md, xl) { ... }
 //    @include container-breakpoint-between(md, xl, sidebar) { ... }  // Query named container
 //
-@mixin container-breakpoint-between($lower, $upper, $container-name: null, $breakpoints: $grid-breakpoints) {
+@mixin container-breakpoint-between($lower, $upper, $container-name: null, $breakpoints: $breakpoints) {
   $min: breakpoint-min($lower, $breakpoints);
   $max: breakpoint-max($upper, $breakpoints);
 
 //    @include container-breakpoint-only(md) { ... }
 //    @include container-breakpoint-only(md, sidebar) { ... }  // Query named container
 //
-@mixin container-breakpoint-only($name, $container-name: null, $breakpoints: $grid-breakpoints) {
+@mixin container-breakpoint-only($name, $container-name: null, $breakpoints: $breakpoints) {
   $min:  breakpoint-min($name, $breakpoints);
   $next: breakpoint-next($name, $breakpoints);
   $max:  breakpoint-max($next, $breakpoints);
index 465d5f53406a0ee45528062f692ef488d581ea60..b82fd17d9dc8394847d0d0cac9c10c91da6da957 100644 (file)
@@ -29,7 +29,7 @@
         @extend .container-fluid;
       }
 
-      @include media-breakpoint-up($breakpoint, $grid-breakpoints) {
+      @include media-breakpoint-up($breakpoint, $breakpoints) {
         // Extend each breakpoint which is smaller or equal to the current breakpoint
         $extend-breakpoint: true;
 
@@ -37,9 +37,9 @@
           max-width: $container-max-width;
         }
 
-        @each $name, $width in $grid-breakpoints {
+        @each $name, $width in $breakpoints {
           @if ($extend-breakpoint) {
-            .container#{breakpoint-infix($name, $grid-breakpoints)} {
+            .container#{breakpoint-infix($name, $breakpoints)} {
               @extend %responsive-container-#{$breakpoint};
             }
 
index b2aadaf0bff65fac346c7619db33fd6fdb25735d..c15ba84e4d0e66a4ba6bc8d045dce5b80bf8289a 100644 (file)
@@ -4,12 +4,6 @@
 // mdo-do
 // - check gap utilities as replacement for gutter classes from v5
 
-:root {
-  @each $name, $value in $grid-breakpoints {
-    --breakpoint-#{$name}: #{$value};
-  }
-}
-
 @layer layout {
   @if $enable-grid-classes {
     .row {
index c17415b03431fd15c38a216c2d6526bed607ba3d..e6c5a82a4e138bdd2856e1d84db881733bd4c77d 100644 (file)
@@ -71,7 +71,7 @@
 // Used only by Bootstrap to generate the correct number of grid classes given
 // any value of `$grid-columns`.
 
-@mixin make-grid-columns($columns: $grid-columns, $gutter: $grid-gutter-width, $breakpoints: $grid-breakpoints) {
+@mixin make-grid-columns($columns: $grid-columns, $gutter: $grid-gutter-width, $breakpoints: $breakpoints) {
   @each $breakpoint in map.keys($breakpoints) {
     $infix: breakpoint-infix($breakpoint, $breakpoints);
 
   }
 }
 
-@mixin make-cssgrid($columns: $grid-columns, $breakpoints: $grid-breakpoints) {
+@mixin make-cssgrid($columns: $grid-columns, $breakpoints: $breakpoints) {
   @each $breakpoint in map.keys($breakpoints) {
     $infix: breakpoint-infix($breakpoint, $breakpoints);
 
index abd1c10d632b93e8486d58cc8c0648fdfb24b431..cf8a8a8dc476d787991aa5b0b04dd11c215c3689 100644 (file)
@@ -28,7 +28,7 @@ $utilities: ();
       )
     ) !global;
 
-    $grid-breakpoints: (
+    $breakpoints: (
       xs: 0,
       sm: 333px,
       md: 666px
index 9f12172a4e95d75d139fbbd95517e43efee1320d..0fe8ff71ec2abbb11e58396fb76149e65cf72437 100644 (file)
@@ -7,11 +7,11 @@
 
 @layer utilities {
   // Loop over each breakpoint
-  @each $breakpoint in map.keys($grid-breakpoints) {
+  @each $breakpoint in map.keys($breakpoints) {
 
     // Generate media query if needed
     @include media-breakpoint-up($breakpoint) {
-      $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
+      $infix: breakpoint-infix($breakpoint, $breakpoints);
 
       // Loop over each utility property
       @each $key, $utility in $utilities {
index 8769cf356cf47e86e567306b6fac842eb5459f77..32de4d340e0fef0c6cfe8c08629c17513c7e37c6 100644 (file)
@@ -715,7 +715,7 @@ When you do this, we recommend including additional JavaScript to move the focus
 
 ### Sass map
 
-We reassign the global `$grid-breakpoints` map to `$navbar-breakpoints` in `scss/_navbar.scss` and use this for our loop to generate the responsive navbar expand/collapse classes. This allows you to customize the breakpoints for navbars independently of the global breakpoints.
+We reassign the global `$breakpoints` map to `$navbar-breakpoints` in `scss/_navbar.scss` and use this for our loop to generate the responsive navbar expand/collapse classes. This allows you to customize the breakpoints for navbars independently of the global breakpoints.
 
 <ScssDocs name="navbar-breakpoints" file="scss/_navbar.scss" />
 
index c9c798b8c52e207f060d78e280d40641bc0e1ace..c2833e36d850c46a91504155bf424d9835484bb4 100644 (file)
@@ -20,13 +20,13 @@ Check out [our Sass maps and loops docs]([[docsref:/customize/sass#maps-and-loop
 
 ## Responsive
 
-These Sass loops aren't limited to color maps, either. You can also generate responsive variations of your components. Take for example our responsive navbar expand classes where we mix an `@each` loop for the `$grid-breakpoints` Sass map with a media query include.
+These Sass loops aren't limited to color maps, either. You can also generate responsive variations of your components. Take for example our responsive navbar expand classes where we mix an `@each` loop for the `$breakpoints` Sass map with a media query include.
 
 <ScssDocs name="navbar-expand-loop" file="scss/_navbar.scss" />
 
-Should you modify your `$grid-breakpoints`, your changes will apply to all the loops iterating over that map.
+Should you modify your `$breakpoints`, your changes will apply to all the loops iterating over that map.
 
-<ScssDocs name="grid-breakpoints" file="scss/_config.scss" />
+<ScssDocs name="breakpoints" file="scss/_config.scss" />
 
 For more information and examples on how to modify our Sass maps and variables, please refer to [the CSS section of the Grid documentation]([[docsref:/layout/grid#css]]).
 
index 79bc2b1e0ced0efe702e6c8fe7b6e1080e3038e7..99b42714cb675bd5cf6c791f92ade16e334c5aa3 100644 (file)
@@ -32,7 +32,7 @@ Each breakpoint was chosen to comfortably hold containers whose widths are multi
 
 These breakpoints are customizable via Sass—you’ll find them in a Sass map in our `_variables.scss` stylesheet.
 
-<ScssDocs name="grid-breakpoints" file="scss/_config.scss" />
+<ScssDocs name="breakpoints" file="scss/_config.scss" />
 
 For more information and examples on how to modify our Sass maps and variables, please refer to [the CSS section of the Grid documentation]([[docsref:/layout/grid#css]]).
 
index 0ea0d0403423920efab386a8475c552b92725e31..99fb2ee11fb60cea5ed6f0f0db6fde15187c725b 100644 (file)
@@ -378,7 +378,7 @@ $grid-gutter-width: 1.5rem;
 $grid-row-columns:  6;
 ```
 
-<ScssDocs name="grid-breakpoints" file="scss/_config.scss" />
+<ScssDocs name="breakpoints" file="scss/_config.scss" />
 
 <ScssDocs name="container-max-widths" file="scss/_config.scss" />
 
@@ -463,10 +463,10 @@ $grid-row-columns: 6 !default;
 
 ### Grid tiers
 
-Moving beyond the columns themselves, you may also customize the number of grid tiers. If you wanted just four grid tiers, you’d update the `$grid-breakpoints` and `$container-max-widths` to something like this:
+Moving beyond the columns themselves, you may also customize the number of grid tiers. If you wanted just four grid tiers, you’d update the `$breakpoints` and `$container-max-widths` to something like this:
 
 ```scss
-$grid-breakpoints: (
+$breakpoints: (
   xs: 0,
   sm: 480px,
   md: 768px,