Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Separator examples · Basic

Simple Line Separator for React

A single horizontal separator with its default styles and no surrounding content.

Framework
UI library

Sometimes you only need the line. This React Separator has no classes and no neighbors: one pixel tall, full width, in your theme's border color. Use it as a building block inside a layout that already owns its spacing, or as a reference when you're checking theme tokens.

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

What are the default Separator styles?

Horizontal orientation, one pixel tall, full width, bg-border and shrink-0. The color follows the --border token, so the line tracks light and dark themes without extra classes.

How do I customize the simple separator?

Add classes in className. Color is a background utility, such as bg-primary. Thickness has to use the component's orientation variant, data-horizontal:h-1, so it replaces the default height instead of losing to it.

When would I use a separator with no surrounding content?

Inside a parent that already sets the spacing, such as a flex column with a gap, or as a specimen in a style guide. Real screens almost always pair it with content, as the Horizontal Separator and List Separator examples do.

Does the simple separator have a separator role by default?

Yes. The element has role separator and an aria-orientation.

How do I add spacing around a simple separator?

Prefer a gap on a flex parent over margins on the line: the gap keeps the rhythm even when the siblings change. Use my-* only when the separator must own its spacing, as the With Margins example does.

Are separators expensive to render?

No. A Separator is one styled element with a few attributes and no behavior. Render as many as the layout needs.