shadcn.io is not affiliated with official shadcn/ui
Separator examples · Basic
Horizontal Separator for React
A horizontal separator that divides a title block from the text below it.
Divide stacked content with a single horizontal line. This React Separator uses its default horizontal orientation inside a flex column, so the space around the line comes from the column's gap rather than margins. Use it for article sections, settings groups, card bodies and any vertical layout that needs a clear break without extra borders.
Preview
Installation
FAQ
When should I use a horizontal separator instead of spacing alone?
When sections are related but distinct and spacing alone is ambiguous. Pair the Separator with a heading, so people who see the line get a visual break and the headings still carry the structure. Skip it between every paragraph, or where cards already draw a boundary.
How much space should surround a horizontal separator?
flex flex-col gap-4 gives a comfortable 16 pixel rhythm, as here. Tighten to gap-2 for dense lists, or open to gap-8 for major breaks. The gap is equal above and below, so the line sits in the middle of the pause.
How do I change color or thickness?
Pass classes in className. The line is painted with a background, so color uses bg-* utilities. Thickness has to use the same orientation variant as the component, such as data-horizontal:h-1, so it replaces the default one-pixel height rather than losing to it.
Is the horizontal Separator announced by screen readers?
Yes. The line has role separator, so screen readers can announce it. When it's only visual, a border on a neighbor is quieter than a Separator.
Related
- Vertical SeparatorVertical separators between inline items
- Section Divider SeparatorA horizontal separator between two titled
- Simple Line SeparatorA single horizontal separator with its
- List SeparatorHorizontal separators between the rows of
- In Navigation SeparatorVertical separators between navigation
- Standard CardA basic card with a title, a description