Separator
Draws a thin line between two groups of things.
Examples
Maya Lens
Spending and savings
24 transactions12 friends
- Transfer
- $250.00
- Fee
- $1.50
Total $251.50
Orientation
- ActivityScheduled
horizontaldefault
- 24 sent12 friends
vertical
Usage
When to use it
- Use
- Two groups in a card or panel that read as one block without a break.
- Use
- Items in a row, such as two counts, with a vertical line between.
- Not for
- Two cards or sections that already have a surface. Use Card.
- Not for
- Rows of a table; Table draws its row lines. Use Table.
- Not for
- A title over a section. Use a heading.
Rules
7 rules
- Should
- Try 24px of space, then a surface, before a line.
- Must
- Put a vertical separator in a row with a set height. Because it is h-full, which resolves to nothing in a row with no height, so the line vanishes.
- Never
- Pass a label; write the word as text with a separator on each side. Because Separator has no label prop, so the word never renders.
- Never
- Put a separator between cards; each is already a grey surface. Because the gap between two grey cards already splits them, and the line adds a third edge.
- Must
- Pass decorative when markup already makes the split, so no separator role is announced. Because two lists already announce their ends, so a screen reader hears an extra separator.
- Should
- Use at most three separators in a panel; regroup with headings past that.
- Must
- Set only the length in className; keep the 1px thickness. Because a thicker or darker line competes with the content it was meant to group.
Accessibility
3 checks
- The default role is separator with aria-orientation; pass decorative for a purely visual line.
- A separator takes no focus or input.
- The line is a background fill; verify it in forced colors, which may drop it.
Edge cases
5 edge cases
- Narrow container
- A horizontal line fills the column at any width.
- Right to left
- The line is symmetric; nothing mirrors.
- Vertical in a row with no height
- It collapses to nothing and is invisible.
- Inside a toolbar or menu
- Use their own separators.
- Zoom 200%
- The line stays 1px.
API
2 props
orientation'horizontal' | 'vertical'default'horizontal'decorativebooleandefaultfalse
Tokens
1 token
--line- #e6e4df