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.
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
Installation
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.
Related
- Horizontal SeparatorA horizontal separator that divides a
- Section Divider SeparatorA horizontal separator between two titled
- Vertical SeparatorVertical separators between inline items
- In Navigation SeparatorVertical separators between navigation
- Standard CardA basic card with a title, a description
- Standard DialogA share dialog with a read-only link, a