aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2021-05-22 00:51:30 -0700
committerGitHub <[email protected]>2021-05-22 10:51:30 +0300
commit803397554836dcba736eb50020ed3cea07b3a3ea (patch)
treedeef611c461d889efc0fcacbbb324f1ebfa6bba8
parente06e6dfe53b663b7ec557495d46f685734a6a5a4 (diff)
downloadbootstrap-803397554836dcba736eb50020ed3cea07b3a3ea.tar.xz
bootstrap-803397554836dcba736eb50020ed3cea07b3a3ea.zip
Document how to make utilities responsive using the API (#34062)
-rw-r--r--site/content/docs/5.0/utilities/api.md51
1 files changed, 51 insertions, 0 deletions
diff --git a/site/content/docs/5.0/utilities/api.md b/site/content/docs/5.0/utilities/api.md
index 6610f9ee0..ba0c6a984 100644
--- a/site/content/docs/5.0/utilities/api.md
+++ b/site/content/docs/5.0/utilities/api.md
@@ -289,6 +289,57 @@ $utilities: map-merge(
);
```
+#### Enable responsive
+
+You can enable responsive classes for an existing set of utilities that are not currently responsive by default. For example, to make the `border` classes responsive:
+
+```scss
+@import "bootstrap/scss/functions";
+@import "bootstrap/scss/variables";
+@import "bootstrap/scss/utilities";
+
+$utilities: map-merge(
+ $utilities, (
+ "border": map-merge(
+ map-get($utilities, "border"),
+ ( responsive: true ),
+ ),
+ )
+);
+```
+
+This will now generate responsive variations of `.border` and `.border-0` for each breakpoint. Your generated CSS will look like this:
+
+```css
+.border { ... }
+.border-0 { ... }
+
+@media (min-width: 576px) {
+ .border-sm { ... }
+ .border-sm-0 { ... }
+}
+
+@media (min-width: 768px) {
+ .border-md { ... }
+ .border-md-0 { ... }
+}
+
+@media (min-width: 992px) {
+ .border-lg { ... }
+ .border-lg-0 { ... }
+}
+
+@media (min-width: 1200px) {
+ .border-xl { ... }
+ .border-xl-0 { ... }
+}
+
+@media (min-width: 1400px) {
+ .border-xxl { ... }
+ .border-xxl-0 { ... }
+}
+```
+
#### Rename utilities
Missing v4 utilities, or used to another naming convention? The utilities API can be used to override the resulting `class` of a given utility—for example, to rename `.ms-*` utilities to oldish `.ml-*`: