Skip to content

Commit 7342b48

Browse files
authored
chore(docs): Documents recently added layout spacers. (#4730)
1 parent 777009a commit 7342b48

File tree

1 file changed

+15
-14
lines changed
  • packages/documentation-site/patternfly-docs/content/design-guidelines/styles/spacers

1 file changed

+15
-14
lines changed

packages/documentation-site/patternfly-docs/content/design-guidelines/styles/spacers/spacers.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,16 @@ section: design-foundations
44
---
55
import './spacers.css';
66

7-
87
PatternFly designs use **spacers** to define fixed amounts of space between UI elements. They help you create designs that are visually balanced and consistent. Spacers are built into PatternFly components, and are also available as tokens for you to use within Figma's auto layout system:
98

109
![Spacer tokens displayed as options in a Figma layout menu](./auto-layout-spacers.png)
1110

1211
## Spacer sizing
13-
1412
Like the rest of our dimension tokens, spacers use rem sizing, rather than pixels. Rems are relative units that adjust size based on a webpage's HTML document root element size. For example, if the root size is 10px, a rem size of 1.5 would be 15px.
1513

1614
PatternFly's default root element size is 16px. If you change this default size, note that the following table will no longer show accurate pixel measurements (though the rem values will stay the same).
17-
## PatternFly spacers
1815

16+
## PatternFly spacers
1917
Our spacers include the following sizes:
2018

2119
| **Spacer** | **Token** | **Size** | **Example** |
@@ -27,34 +25,38 @@ Our spacers include the following sizes:
2725
| xl | `--pf-t--global--spacer--xl` | 2rem (32px) |<div class="ws-content-spacer32"></div> |
2826
| 2xl | `--pf-t--global--spacer--2xl` | 3rem (48px) | <div class="ws-content-spacer48"></div> |
2927
| 3xl | `--pf-t--global--spacer--3xl` | 4rem (64px) | <div class="ws-content-spacer64"></div> |
30-
| 4xl | `--pf-t--global--spacer--4xl` | 5rem (80px) | <div class="ws-content-spacer80"></div>
28+
| 4xl | `--pf-t--global--spacer--4xl` | 5rem (80px) | <div class="ws-content-spacer80"></div> |
3129

3230
### Spacer tokens
33-
3431
Our spacer tokens are based on the values in the previous table, but there are certain use cases that align with more specific tokens. When using spacers in these scenarios, always use these more specific semantic tokens, rather than a global spacer token.
3532
- **Action spacers:** Used to set horizontal and vertical padding within actions, like buttons.
36-
- Action spacer tokens begin with `--pf-t--global--spacer--action--`
33+
- Action spacer tokens begin with `--pf-t--global--spacer--action`
3734
- **Control spacers:** Used to set horizontal and vertical padding within controls, like menu toggles and text inputs.
38-
- Control spacer tokens begin with `--pf-t--global--spacer--control--`
39-
- **Gap spacers:** Used to set space between elements or groups of elements, like gaps between multiple actions, gaps between items in a group, gaps between controls, and so on.
40-
- Gap spacer tokens begin with `--pf-t--global--spacer--gap`
41-
35+
- Control spacer tokens begin with `--pf-t--global--spacer--control`
36+
- **Layout spacers:** Used to define spacing within a page.
37+
- **Gap spacers:** Used to set space between elements or groups of elements, like gaps between multiple actions, gaps between items in a group, gaps between controls, and so on.
38+
- Gap spacer tokens begin with `--pf-t--global--spacer--gap`
39+
- **Gutter spacer:** Used to define gutters within a [layout](/layouts/about-layouts), like the space between elements in a grid layout.
40+
- Gutter spacer tokens begin with `--pf-t--global--spacer--gutter`
41+
- **Inset spacer:** Used to define inner padding for structural elements in order to ensure proper alignment, like in the masthead, navigation menu, or the main page content area.
42+
- Inset spacer tokens begin with `--pf-t--global--spacer--inset`
43+
4244
You can search for spacer tokens in [our list of all tokens.](/tokens/all-patternfly-tokens)
45+
4346
## Considering line height and padding
4447

4548
There are additional considerations to keep in mind when adapting spacers to different line heights and padding, which are common with PatternFly components and text content.
4649

4750
### Using spacers with components
48-
4951
Some components like icons, buttons, and input fields, have a fixed amount of padding built in. Remember to account for this extra space when laying the content out on your page. You may not have as much horizontal or vertical room as you think.
5052

5153
For example, padding around this vertical ellipsis (or "kebab") icon increases the amount of space that it takes up in a component:
5254

5355
![A vertical ellipsis icon with an extra small spacer symbol.](./icon-spacing.png)
5456

5557
When laying out your design, make sure to account for this extra padding.
56-
### Using spacers with text
5758

59+
### Using spacers with text
5860
When spacing out text-based content, use the standard [global spacer tokens.](/design-foundations/spacers#patternfly-spacers)
5961

6062
You should consider line height to ensure that you’re leaving the right amount of vertical space between each line of text:
@@ -65,5 +67,4 @@ You also need to use different spacer sizes depending on the type of text you’
6567

6668
![Different-sized spacers placed between heading, body, and list text](./complex-text-spacing.png)
6769

68-
For more information about line height and text spacing, read our [typography guidelines.](/design-foundations/typography)
69-
70+
For more information about line height and text spacing, read our [typography guidelines.](/design-foundations/typography)

0 commit comments

Comments
 (0)