Divider
A line between things: across a column, up a toolbar row, or with a word in the middle ("or") between two ways of signing in.
Anatomy
div[aria-hidden] .h-px.w-full.bg-divider horizontal, decorative (default)
div[role=separator][aria-orientation=vertical] decorative=false, vertical
div.flex.items-center.gap-3 with a label
├── span[aria-hidden] line
├── span "or"
└── span[aria-hidden] line
Decorative, or a separator
Most dividers space things out, and a screen reader saying "separator"
between two paragraphs is noise: by default it is aria-hidden. When the
line means something, between groups in a menu or a toolbar, pass
:decorative="false" and it is role="separator" (vertical ones add
aria-orientation="vertical"; horizontal is the role's default).
A labelled divider is its word, read as text, with lines either side that are hidden; it never takes the role, because the word says what the role would.
Vertical
orientation="vertical" is w-px self-stretch: it is as tall as the flex
row it sits in, with no height to set.
Colour
bg-divider, the token for lines inside a surface. A divider is not a
boundary anyone must find, so it has no contrast minimum (WCAG 1.4.11 does
not apply); its label is fg-muted.
Do not
- Do not use it for a card's edge: that is the panel's border.
- Do not give every divider the role. One a screen reader announces should mark a real change of group.
From the package repo: edit this page on GitHub.