Skip to content
shadcn.io

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.

Framework
UI library

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

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

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.

Should horizontal separators change on mobile?

Usually not: a full-width line works at every width. If a mobile layout turns the sections into cards, drop the separator there and keep it where the page is one column.

How do I keep horizontal separators accessible?

Rely on headings for the structure and use the line as a visual aid. Check that the border color has enough contrast against the page background, so people with low vision still see the division.