Skip to content

Commit 20ab821

Browse files
authored
Sass docs updates (#37897)
* Add maps * Redesign scss-docs rendering * Update other CSS sections * Fix linter
1 parent eec5015 commit 20ab821

22 files changed

+133
-46
lines changed

scss/_maps.scss

+12
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
$theme-colors-rgb: map-loop($theme-colors, to-rgb, "$value") !default;
77
// scss-docs-end theme-colors-rgb
88

9+
// scss-docs-start theme-text-map
910
$theme-colors-text: (
1011
"primary": $primary-text,
1112
"secondary": $secondary-text,
@@ -16,7 +17,9 @@ $theme-colors-text: (
1617
"light": $light-text,
1718
"dark": $dark-text,
1819
) !default;
20+
// scss-docs-end theme-text-map
1921

22+
// scss-docs-start theme-bg-subtle-map
2023
$theme-colors-bg-subtle: (
2124
"primary": $primary-bg-subtle,
2225
"secondary": $secondary-bg-subtle,
@@ -27,7 +30,9 @@ $theme-colors-bg-subtle: (
2730
"light": $light-bg-subtle,
2831
"dark": $dark-bg-subtle,
2932
) !default;
33+
// scss-docs-end theme-bg-subtle-map
3034

35+
// scss-docs-start theme-border-subtle-map
3136
$theme-colors-border-subtle: (
3237
"primary": $primary-border-subtle,
3338
"secondary": $secondary-border-subtle,
@@ -38,12 +43,14 @@ $theme-colors-border-subtle: (
3843
"light": $light-border-subtle,
3944
"dark": $dark-border-subtle,
4045
) !default;
46+
// scss-docs-end theme-border-subtle-map
4147

4248
$theme-colors-text-dark: null !default;
4349
$theme-colors-bg-subtle-dark: null !default;
4450
$theme-colors-border-subtle-dark: null !default;
4551

4652
@if $enable-dark-mode {
53+
// scss-docs-start theme-text-dark-map
4754
$theme-colors-text-dark: (
4855
"primary": $primary-text-dark,
4956
"secondary": $secondary-text-dark,
@@ -54,7 +61,9 @@ $theme-colors-border-subtle-dark: null !default;
5461
"light": $light-text-dark,
5562
"dark": $dark-text-dark,
5663
) !default;
64+
// scss-docs-end theme-text-dark-map
5765

66+
// scss-docs-start theme-bg-subtle-dark-map
5867
$theme-colors-bg-subtle-dark: (
5968
"primary": $primary-bg-subtle-dark,
6069
"secondary": $secondary-bg-subtle-dark,
@@ -65,7 +74,9 @@ $theme-colors-border-subtle-dark: null !default;
6574
"light": $light-bg-subtle-dark,
6675
"dark": $dark-bg-subtle-dark,
6776
) !default;
77+
// scss-docs-end theme-bg-subtle-dark-map
6878

79+
// scss-docs-start theme-border-subtle-dark-map
6980
$theme-colors-border-subtle-dark: (
7081
"primary": $primary-border-subtle-dark,
7182
"secondary": $secondary-border-subtle-dark,
@@ -76,6 +87,7 @@ $theme-colors-border-subtle-dark: null !default;
7687
"light": $light-border-subtle-dark,
7788
"dark": $dark-border-subtle-dark,
7889
) !default;
90+
// scss-docs-end theme-border-subtle-dark-map
7991
}
8092

8193
// Utilities maps

scss/_variables-dark.scss

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
// scss-docs-start sass-dark-mode-vars
10+
// scss-docs-start theme-text-dark-variables
1011
$primary-text-dark: $blue-300 !default;
1112
$secondary-text-dark: $gray-300 !default;
1213
$success-text-dark: $green-300 !default;
@@ -15,7 +16,9 @@ $warning-text-dark: $yellow-300 !default;
1516
$danger-text-dark: $red-300 !default;
1617
$light-text-dark: $gray-100 !default;
1718
$dark-text-dark: $gray-300 !default;
19+
// scss-docs-end theme-text-dark-variables
1820

21+
// scss-docs-start theme-bg-subtle-dark-variables
1922
$primary-bg-subtle-dark: $blue-900 !default;
2023
$secondary-bg-subtle-dark: $gray-900 !default;
2124
$success-bg-subtle-dark: $green-900 !default;
@@ -24,7 +27,9 @@ $warning-bg-subtle-dark: $yellow-900 !default;
2427
$danger-bg-subtle-dark: $red-900 !default;
2528
$light-bg-subtle-dark: $gray-800 !default;
2629
$dark-bg-subtle-dark: mix($gray-800, $black) !default;
30+
// scss-docs-end theme-bg-subtle-dark-variables
2731

32+
// scss-docs-start theme-border-subtle-dark-variables
2833
$primary-border-subtle-dark: $blue-700 !default;
2934
$secondary-border-subtle-dark: $gray-700 !default;
3035
$success-border-subtle-dark: $green-700 !default;
@@ -33,6 +38,7 @@ $warning-border-subtle-dark: $yellow-800 !default;
3338
$danger-border-subtle-dark: $red-700 !default;
3439
$light-border-subtle-dark: $gray-700 !default;
3540
$dark-border-subtle-dark: $gray-800 !default;
41+
// scss-docs-end theme-border-subtle-dark-variables
3642

3743
$body-color-dark: $gray-500 !default;
3844
$body-bg-dark: $gray-900 !default;

scss/_variables.scss

+6
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ $theme-colors: (
321321
) !default;
322322
// scss-docs-end theme-colors-map
323323

324+
// scss-docs-start theme-text-variables
324325
$primary-text: $blue-700 !default;
325326
$secondary-text: $gray-700 !default;
326327
$success-text: $green-700 !default;
@@ -329,7 +330,9 @@ $warning-text: $yellow-800 !default;
329330
$danger-text: $red-700 !default;
330331
$light-text: $gray-700 !default;
331332
$dark-text: $gray-700 !default;
333+
// scss-docs-end theme-text-variables
332334

335+
// scss-docs-start theme-bg-subtle-variables
333336
$primary-bg-subtle: $blue-100 !default;
334337
$secondary-bg-subtle: $gray-100 !default;
335338
$success-bg-subtle: $green-100 !default;
@@ -338,7 +341,9 @@ $warning-bg-subtle: $yellow-100 !default;
338341
$danger-bg-subtle: $red-100 !default;
339342
$light-bg-subtle: mix($gray-100, $white) !default;
340343
$dark-bg-subtle: $gray-400 !default;
344+
// scss-docs-end theme-bg-subtle-variables
341345

346+
// scss-docs-start theme-border-subtle-variables
342347
$primary-border-subtle: $blue-200 !default;
343348
$secondary-border-subtle: $gray-200 !default;
344349
$success-border-subtle: $green-200 !default;
@@ -347,6 +352,7 @@ $warning-border-subtle: $yellow-200 !default;
347352
$danger-border-subtle: $red-200 !default;
348353
$light-border-subtle: $gray-200 !default;
349354
$dark-border-subtle: $gray-500 !default;
355+
// scss-docs-end theme-border-subtle-variables
350356

351357
// Characters which are escaped by the escape-svg function
352358
$escaped-characters: (

site/assets/scss/_component-examples.scss

+7
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@
380380

381381
.highlight {
382382
margin-bottom: 0;
383+
@include border-top-radius(0);
383384
}
384385

385386
.bd-example {
@@ -398,6 +399,12 @@
398399
background-color: var(--bd-pre-bg);
399400
}
400401

402+
.bd-scss-docs {
403+
.highlight-toolbar {
404+
@include border-top-radius(calc(var(--bs-border-radius) + 1px));
405+
}
406+
}
407+
401408
.focused {
402409
outline: 0;
403410
box-shadow: var(--#{$variable-prefix}focus-ring-offset), var(--#{$variable-prefix}focus-ring-x, 0) var(--#{$variable-prefix}focus-ring-y, 0) var(--#{$variable-prefix}focus-ring-blur) var(--#{$variable-prefix}focus-ring-width) var(--#{$variable-prefix}focus-ring-color);

site/content/docs/5.3/components/carousel.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,9 @@ Add `.carousel-dark` to the `.carousel` for darker controls, indicators, and cap
347347

348348
The transition duration of `.carousel-item` can be changed with the `$carousel-transition-duration` Sass variable before compiling or custom styles if you're using the compiled CSS. If multiple transitions are applied, make sure the transform transition is defined first (e.g. `transition: transform 2s ease, opacity .5s ease-out`).
349349

350-
## Sass
350+
## CSS
351351

352-
### Variables
352+
### Sass variables
353353

354354
Variables for all carousels:
355355

site/content/docs/5.3/components/collapse.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ If your control element is targeting a single collapsible element – i.e. the `
100100

101101
Note that Bootstrap's current implementation does not cover the various *optional* keyboard interactions described in the [ARIA Authoring Practices Guide accordion pattern](https://www.w3.org/WAI/ARIA/apg/patterns/accordion/) - you will need to include these yourself with custom JavaScript.
102102

103-
## Sass
103+
## CSS
104104

105-
### Variables
105+
### Sass variables
106106

107107
{{< scss-docs name="collapse-transition" file="scss/_variables.scss" >}}
108108

site/content/docs/5.3/content/figures.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ Aligning the figure's caption is easy with our [text utilities]({{< docsref "/ut
2626
</figure>
2727
{{< /example >}}
2828

29-
## Sass
29+
## CSS
3030

31-
### Variables
31+
### Sass variables
3232

3333
{{< scss-docs name="figure-variables" file="scss/_variables.scss" >}}

site/content/docs/5.3/content/tables.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -823,13 +823,13 @@ Use `.table-responsive{-sm|-md|-lg|-xl|-xxl}` as needed to create responsive tab
823823
{{< /tables.inline >}}
824824
{{< /highlight >}}
825825

826-
## Sass
826+
## CSS
827827

828-
### Variables
828+
### Sass variables
829829

830830
{{< scss-docs name="table-variables" file="scss/_variables.scss" >}}
831831

832-
### Loop
832+
### Sass loop
833833

834834
{{< scss-docs name="table-loop" file="scss/_variables.scss" >}}
835835

site/content/docs/5.3/content/typography.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,9 @@ Align terms and descriptions horizontally by using our grid system's predefined
269269

270270
In Bootstrap 5, we've enabled responsive font sizes by default, allowing text to scale more naturally across device and viewport sizes. Have a look at the [RFS page]({{< docsref "/getting-started/rfs" >}}) to find out how this works.
271271

272-
## Sass
272+
## CSS
273273

274-
### Variables
274+
### Sass variables
275275

276276
Headings have some dedicated variables for sizing and spacing.
277277

@@ -281,6 +281,6 @@ Miscellaneous typography elements covered here and in [Reboot]({{< docsref "/con
281281

282282
{{< scss-docs name="type-variables" file="scss/_variables.scss" >}}
283283

284-
### Mixins
284+
### Sass mixins
285285

286286
There are no dedicated mixins for typography, but Bootstrap does use [Responsive Font Sizing (RFS)]({{< docsref "/getting-started/rfs" >}}).

site/content/docs/5.3/forms/checks-radios.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,9 @@ Different variants of `.btn`, such at the various outlined styles, are supported
300300
<label class="btn btn-outline-danger" for="danger-outlined">Danger radio</label>
301301
{{< /example >}}
302302

303-
## Sass
303+
## CSS
304304

305-
### Variables
305+
### Sass variables
306306

307307
Variables for checks:
308308

site/content/docs/5.3/forms/input-group.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ Input groups include support for custom selects and custom file inputs. Browser
312312
</div>
313313
{{< /example >}}
314314

315-
## Sass
315+
## CSS
316316

317-
### Variables
317+
### Sass variables
318318

319319
{{< scss-docs name="input-group-variables" file="scss/_variables.scss" >}}

site/content/docs/5.3/forms/overview.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ If none of these are present, assistive technologies may resort to using the `pl
105105

106106
While using visually hidden content (`.visually-hidden`, `aria-label`, and even `placeholder` content, which disappears once a form field has content) will benefit assistive technology users, a lack of visible label text may still be problematic for certain users. Some form of visible label is generally the best approach, both for accessibility and usability.
107107

108-
## Sass
108+
## CSS
109109

110110
Many form variables are set at a general level to be re-used and extended by individual form components. You'll see these most often as `$input-btn-*` and `$input-*` variables.
111111

112-
### Variables
112+
### Sass variables
113113

114114
`$input-btn-*` variables are shared global variables between our [buttons]({{< docsref "/components/buttons" >}}) and our form components. You'll find these frequently reassigned as values to other component-specific variables.
115115

site/content/docs/5.3/forms/range.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ By default, range inputs "snap" to integer values. To change this, you can speci
4242
<input type="range" class="form-range" min="0" max="5" step="0.5" id="customRange3">
4343
{{< /example >}}
4444

45-
## Sass
45+
## CSS
4646

47-
### Variables
47+
### Sass variables
4848

4949
{{< scss-docs name="form-range-variables" file="scss/_variables.scss" >}}

site/content/docs/5.3/forms/select.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ Add the `disabled` boolean attribute on a select to give it a grayed out appeara
7474
</select>
7575
{{< /example >}}
7676

77-
## Sass
77+
## CSS
7878

79-
### Variables
79+
### Sass variables
8080

8181
{{< scss-docs name="form-select-variables" file="scss/_variables.scss" >}}

site/content/docs/5.3/forms/validation.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -349,27 +349,27 @@ If your form layout allows it, you can swap the `.{valid|invalid}-feedback` clas
349349
</form>
350350
{{< /example >}}
351351

352-
## Sass
352+
## CSS
353353

354-
### Variables
354+
### Sass variables
355355

356356
{{< scss-docs name="form-feedback-variables" file="scss/_variables.scss" >}}
357357

358-
### Mixins
358+
### Sass mixins
359359

360360
Two mixins are combined together, through our [loop](#loop), to generate our form validation feedback styles.
361361

362362
{{< scss-docs name="form-validation-mixins" file="scss/mixins/_forms.scss" >}}
363363

364-
### Map
364+
### Sass map
365365

366366
This is the validation Sass map from `_variables.scss`. Override or extend this to generate different or additional states.
367367

368368
{{< scss-docs name="form-validation-states" file="scss/_variables.scss" >}}
369369

370370
Maps of `$form-validation-states` can contain three optional parameters to override tooltips and focus styles.
371371

372-
### Loop
372+
### Sass loop
373373

374374
Used to iterate over `$form-validation-states` map values to generate our validation styles. Any modifications to the above Sass map will be reflected in your compiled CSS via this loop.
375375

site/content/docs/5.3/helpers/stacks.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,6 @@ Create an inline form with `.hstack`:
8080
</div>
8181
{{< /example >}}
8282

83-
## Sass
83+
## CSS
8484

8585
{{< scss-docs name="stacks" file="scss/helpers/_stacks.scss" >}}

site/content/docs/5.3/layout/grid.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -409,11 +409,11 @@ To nest your content with the default grid, add a new `.row` and set of `.col-sm
409409
</div>
410410
{{< /example >}}
411411

412-
## Sass
412+
## CSS
413413

414414
When using Bootstrap's source Sass files, you have the option of using Sass variables and mixins to create custom, semantic, and responsive page layouts. Our predefined grid classes use these same variables and mixins to provide a whole suite of ready-to-use classes for fast responsive layouts.
415415

416-
### Variables
416+
### Sass variables
417417

418418
Variables and maps determine the number of columns, the gutter width, and the media query point at which to begin floating columns. We use these to generate the predefined grid classes documented above, as well as for the custom mixins listed below.
419419

@@ -427,7 +427,7 @@ $grid-row-columns: 6;
427427

428428
{{< scss-docs name="container-max-widths" file="scss/_variables.scss" >}}
429429

430-
### Mixins
430+
### Sass mixins
431431

432432
Mixins are used in conjunction with the grid variables to generate semantic CSS for individual grid columns.
433433

0 commit comments

Comments
 (0)