From 1d011d26b2436517b73391d7cf173760120a279a Mon Sep 17 00:00:00 2001 From: Louis-Maxime Piton Date: Wed, 7 Aug 2024 07:56:17 +0200 Subject: [PATCH] docs(utilities): add 'Display' page (#2659) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Julien Déramond --- site/content/docs/0.0/utilities/display.md | 109 ++++++++++++++++++++- site/data/sidebar.yml | 1 - 2 files changed, 107 insertions(+), 3 deletions(-) diff --git a/site/content/docs/0.0/utilities/display.md b/site/content/docs/0.0/utilities/display.md index abfd4b0127..b5b6920c2e 100644 --- a/site/content/docs/0.0/utilities/display.md +++ b/site/content/docs/0.0/utilities/display.md @@ -1,11 +1,116 @@ --- layout: docs title: Display property -description: Quickly and responsively toggle the display value of components and more with our display utilities. Includes support for some of the more common values, as well as some extras for controlling display when printing. +description: Quickly toggle the display value of components and more with our display utilities. Includes support for some of the more common values, as well as some extras for controlling display when printing. group: utilities aliases: - "/docs/utilities/display/" toc: true --- -{{< callout-soon "page" >}} +## How it works + +Change the value of the [`display` property](https://developer.mozilla.org/en-US/docs/Web/CSS/display) with our display utility classes. We purposely support only a subset of all possible values for `display`. Classes can be combined for various effects as you need. + +## Notation + + + +The classes are named using the format: + +- `.d-{value}` + + +Where *value* is one of: + +- `none` +- `inline` +- `inline-block` +- `block` +- `grid` +- `inline-grid` +- `table` +- `table-cell` +- `table-row` +- `flex` +- `inline-flex` + +The display values can be altered by changing the `display` values defined in `$utilities` and recompiling the SCSS. + + + + + +## Hiding elements + +Use display classes for showing and hiding elements. + +To hide elements simply use the `.d-none` class. + + + +{{< bs-table >}} +| Screen size | Class | +| --- | --- | +| Hidden on all | `.d-none` | +| Visible on all | `.d-block` | + + +{{< /bs-table >}} + + + +## Display in print + +Change the `display` value of elements when printing with our print display utility classes. Includes support for the same `display` values as our `.d-*` utilities. + +- `.d-print-none` +- `.d-print-inline` +- `.d-print-inline-block` +- `.d-print-block` +- `.d-print-grid` +- `.d-print-inline-grid` +- `.d-print-table` +- `.d-print-table-row` +- `.d-print-table-cell` +- `.d-print-flex` +- `.d-print-inline-flex` + +The print and display classes can be combined. + +{{< example >}} +
Screen Only (Hide on print only)
+
Print Only (Hide on screen only)
+ +{{< /example >}} + +## CSS + +### Sass utilities API + +Display utilities are declared in our utilities API in `scss/_utilities.scss`. [Learn how to use the utilities API.]({{< docsref "/utilities/api#using-the-api" >}}) + +{{< scss-docs name="utils-display" file="scss/_utilities.scss" >}} diff --git a/site/data/sidebar.yml b/site/data/sidebar.yml index e947e05deb..a791130e5f 100644 --- a/site/data/sidebar.yml +++ b/site/data/sidebar.yml @@ -216,7 +216,6 @@ - title: Colors draft: true - title: Display - draft: true - title: Flex - title: Float - title: Interactions