From aee169d19288d78330be2df0960ea8924353f84f Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Tue, 22 Jun 2021 22:22:02 -0700 Subject: [PATCH] Split .vr from stacks as a new helper --- scss/_helpers.scss | 1 + scss/helpers/_stacks.scss | 9 ---- scss/helpers/_vr.scss | 8 ++++ site/content/docs/5.0/helpers/stacks.md | 4 +- .../content/docs/5.0/helpers/vertical-rule.md | 44 +++++++++++++++++++ site/data/sidebar.yml | 1 + 6 files changed, 55 insertions(+), 12 deletions(-) create mode 100644 scss/helpers/_vr.scss create mode 100644 site/content/docs/5.0/helpers/vertical-rule.md diff --git a/scss/_helpers.scss b/scss/_helpers.scss index 13fb1bbb5d..4a989f5a5c 100644 --- a/scss/_helpers.scss +++ b/scss/_helpers.scss @@ -6,3 +6,4 @@ @import "helpers/visually-hidden"; @import "helpers/stretched-link"; @import "helpers/text-truncation"; +@import "helpers/vr"; diff --git a/scss/helpers/_stacks.scss b/scss/helpers/_stacks.scss index bb0d4d55a8..6cd237ae6d 100644 --- a/scss/helpers/_stacks.scss +++ b/scss/helpers/_stacks.scss @@ -13,12 +13,3 @@ align-self: stretch; } // scss-docs-end stacks - -.vr { - display: inline-block; - align-self: stretch; - width: 1px; - min-height: 1em; - background-color: currentColor; - opacity: $hr-opacity; -} diff --git a/scss/helpers/_vr.scss b/scss/helpers/_vr.scss new file mode 100644 index 0000000000..37f864777a --- /dev/null +++ b/scss/helpers/_vr.scss @@ -0,0 +1,8 @@ +.vr { + display: inline-block; + align-self: stretch; + width: 1px; + min-height: 1em; + background-color: currentColor; + opacity: $hr-opacity; +} diff --git a/site/content/docs/5.0/helpers/stacks.md b/site/content/docs/5.0/helpers/stacks.md index 41c0ac5462..a93a800460 100644 --- a/site/content/docs/5.0/helpers/stacks.md +++ b/site/content/docs/5.0/helpers/stacks.md @@ -42,9 +42,7 @@ Using horizontal margin utilities like `.ms-auto` as spacers: {{< /example >}} -
-
-
+And with [vertical rules]({{< docsref "/helpers/vertical-rule" >}}): {{< example >}}
diff --git a/site/content/docs/5.0/helpers/vertical-rule.md b/site/content/docs/5.0/helpers/vertical-rule.md new file mode 100644 index 0000000000..8d0d6141f8 --- /dev/null +++ b/site/content/docs/5.0/helpers/vertical-rule.md @@ -0,0 +1,44 @@ +--- +layout: docs +title: Vertical rule +description: Use the custom vertical rule helper to create vertical dividers like the `
` element. +group: helpers +toc: true +--- + +## How it works + +Vertical rules are inspired by the `
` element, allowing you to create vertical dividers in common layouts. They're styled just like `
` elements: + +- They're `1px` wide +- They have `min-height` of `1em` +- Their color is set via `currentColor` and `opacity` + +Customize them with additional styles as needed. + +## Example + +{{< example >}} +
+{{< /example >}} + +Vertical rules scale their height in flex layouts: + +{{< example >}} +
+
+
+{{< /example >}} + +## With stacks + +They can also be used in [stacks]({{< docsref "/helpers/stacks" >}}): + +{{< example >}} +
+
First item
+
Second item
+
+
Third item
+
+{{< /example >}} diff --git a/site/data/sidebar.yml b/site/data/sidebar.yml index fa37b81972..b4f63bfae0 100644 --- a/site/data/sidebar.yml +++ b/site/data/sidebar.yml @@ -92,6 +92,7 @@ - title: Visually hidden - title: Stretched link - title: Text truncation + - title: Vertical rule - title: Utilities pages: -- 2.47.2