Skip to content

Commit c0dfda9

Browse files
MartijnCuppensXhmikosR
authored andcommitted
Configurable display utility classes (#27917)
1 parent 9523746 commit c0dfda9

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

scss/_variables.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,7 @@ $pre-scrollable-max-height: 340px !default;
10901090

10911091
// Utilities
10921092

1093+
$displays: none, inline, inline-block, block, table, table-row, table-cell, flex, inline-flex !default;
10931094
$overflows: auto, hidden !default;
10941095
$positions: static, relative, absolute, fixed, sticky !default;
10951096

scss/utilities/_display.scss

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,9 @@
88
@include media-breakpoint-up($breakpoint) {
99
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
1010

11-
.d#{$infix}-none { display: none !important; }
12-
.d#{$infix}-inline { display: inline !important; }
13-
.d#{$infix}-inline-block { display: inline-block !important; }
14-
.d#{$infix}-block { display: block !important; }
15-
.d#{$infix}-table { display: table !important; }
16-
.d#{$infix}-table-row { display: table-row !important; }
17-
.d#{$infix}-table-cell { display: table-cell !important; }
18-
.d#{$infix}-flex { display: flex !important; }
19-
.d#{$infix}-inline-flex { display: inline-flex !important; }
11+
@each $value in $displays {
12+
.d#{$infix}-#{$value} { display: $value !important; }
13+
}
2014
}
2115
}
2216

@@ -26,13 +20,7 @@
2620
//
2721

2822
@media print {
29-
.d-print-none { display: none !important; }
30-
.d-print-inline { display: inline !important; }
31-
.d-print-inline-block { display: inline-block !important; }
32-
.d-print-block { display: block !important; }
33-
.d-print-table { display: table !important; }
34-
.d-print-table-row { display: table-row !important; }
35-
.d-print-table-cell { display: table-cell !important; }
36-
.d-print-flex { display: flex !important; }
37-
.d-print-inline-flex { display: inline-flex !important; }
23+
@each $value in $displays {
24+
.d-print-#{$value} { display: $value !important; }
25+
}
3826
}

site/docs/4.2/utilities/display.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Where *value* is one of:
3131
* `flex`
3232
* `inline-flex`
3333

34+
The display values can be altered by changing the `$displays` variable and recompiling the SCSS.
35+
3436
The media queries effect screen widths with the given breakpoint *or larger*. For example, `.d-lg-none` sets `display: none;` on both `lg` and `xl` screens.
3537

3638
## Examples

0 commit comments

Comments
 (0)