Stable
Two helpers space things consistently so you do not need your own margins. Stack puts items in a column with even gaps. Inline puts items in a row and wraps them onto the next line when space runs out, which matters in narrow quick views.
Specifications
Anatomy
Anatomy
Size and spacing
Stack
Sections, cards and fields down the page. 16px between items.
Example
Example
Tight stack
Closely related items, such as lines of a loading skeleton or a short list. 8px between items.
Example
Example
Inline, end
Buttons at the end of a form or card, main action last.
Example
Example
Inline, between
Two things pushed to opposite ends, such as a label and a value or a count and an action.
Example
Example
Usage
When to use
- Spacing any group of items: use these instead of margins.
- Rows of buttons or tags that must wrap in narrow views.
When not to use
- Rows of data with columns: use a table.
- Key and value pairs: use a summary list.
Do and don't
Do
- Put the primary button last in a button row.
Don't
- Mix your own margins with stack gaps.
Implementation
HTML
<div class="at-stack">
<div class="at-card">First</div>
<div class="at-card">Second</div>
<div class="at-inline at-inline--end">
<button type="button" class="at-button">Cancel</button>
<button type="button" class="at-button at-button--primary">Save</button>
</div>
</div>Classes
| Class | What it does |
|---|---|
at-stack | Column with 16px gaps |
at-stack--tight | Column with 8px gaps |
at-inline | Wrapping row with 8px gaps |
at-inline--end | Right-aligned row |
at-inline--between | Space between items |
Tokens used
Accessibility
- Keep DOM order the same as visual order.