Separator
A thin line that splits content into groups: sections of a card, items in a toolbar, links in a footer. Horizontal by default; vertical between items in a row. label puts a word in the middle, such as or between two ways to sign in.
Preview
Usage
When to use
- Split content into groups where spacing alone doesn't show where one ends: sections of a card, groups of menu items.
- Split items in a row, such as links in a footer or buttons in a toolbar.
When not to use
- Framing content on all sides. Use Card.
- A line under every row of a list or table; rows have their own borders.
- Naming a group. Write a heading.
Platform support
What each platform has, from the spec. A selected platform is highlighted.
| Name | Web | iOS | Android | Note |
|---|---|---|---|---|
| orientation | Yes | Yes | Yes | |
| decorative | Yes | Deferred | Deferred | Not generated for iOS and Android. |
| label | Yes | Yes | Yes |
Variants
orientation
horizontal splits stacked content; vertical splits items in a row, such as toolbar buttons.
Examples
Between sections
In a row
Vertical, between links. It stretches to the height of the row.
With a label
or between two ways to sign in. The label is read where it stands.
Read by screen readers
Nothing else splits these two groups, so the line is a separator.
Do and don't
Do
- Use spacing first; add a separator when spacing alone doesn't show where one group ends.
- Give it room on both sides with the gap of its parent, one step larger than the gap inside each group.
Don't
- Don't put a separator under every row of a list or table; rows have their own borders.
- Don't use it to frame content on all sides; that is a Card.
- Don't use it as a heading. A label is a word such as or; a group that needs a name gets a heading.
Props
| Name | Type | Values | Default | Description |
|---|---|---|---|---|
| orientation | enum | horizontal | vertical | horizontal | horizontal splits stacked content; vertical splits items in a row, such as toolbar buttons. |
| decorative | boolean | - | true | Hidden from screen readers. Set false when the line is the only thing that splits two groups. Not generated for iOS and Android. |
| label | node | - | - | A word or two in the middle of a horizontal line: or. Keep it short; a group that needs a name gets a heading. |
Anatomy
| Part | Description |
|---|---|
| root | The line: a 1px border in the divider color, the top border when horizontal (full width) and the start border when vertical (full height of the row). |
| wrapper | With label: the row that holds a line on each side of the label, gap-md. It takes the root's role and className. |
| line | With label: each line, the top border in the divider color, sharing the width that is left. |
| label | With label: 14px secondary text in the middle, on one line. |
Accessibility
Role: none
- Decorative by default: screen readers skip it, since headings and lists already tell them where groups start.
- Set decorative={false} when the line is the only thing that splits two groups; it becomes a separator, and a vertical one says so with aria-orientation.
- With a label, the text is read where it stands. Leave a labelled line decorative: a separator role hides the text inside it from screen readers.
- A separator is never focusable and takes no keyboard input.
Install
npx werewolf-ui add separatorRun npx werewolf-ui init once in your app before adding components. Init sets up tokens, their CSS import and agent rules. Add installs this component and its dependencies while preserving your theme. See Installation for requirements and the alternative registry setup.