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,
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,
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
//
}
// 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: "");
//
// 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;
// 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;
@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 *;
}
// 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);
}
}
-@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();
@use "config" as *;
@use "functions" as *;
-// @use "maps" as *;
@forward "utilities"; // Make utilities available downstream
@use "utilities" as *; // Bring utilities into the current namespace
// check-unused-imports-disable-next-line — side-effect import: generates utility CSS.
@use "utilities/api";
+
+:root {
+ @each $name, $value in $breakpoints {
+ --breakpoint-#{$name}: #{$value};
+ }
+}
// 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} {
}
// 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;
//
// (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.
//
// 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}`";
//
// >> 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);
}
// 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;
}
// "" (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}");
}
// @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);
// @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);
}
// 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);
@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;
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};
}
// 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 {
// 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);
)
) !global;
- $grid-breakpoints: (
+ $breakpoints: (
xs: 0,
sm: 333px,
md: 666px
@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 {
### 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" />
## 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]]).
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]]).
$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" />
### 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,