shadcn.io is not affiliated with official shadcn/ui
Separator examples · Basic
Vertical Separator for React
Vertical separators between inline items in a fixed-height row.
Split inline items with a vertical line. This React Separator sets orientation="vertical" and takes its height from the flex row around it (h-5 items-center), so each one-pixel line spans the row. Use it for navigation trails, metadata rows, toolbars and any horizontal cluster that needs a light divider.
Preview
Installation
FAQ
When should I use a vertical separator?
When content flows in a row: navigation links, toolbar actions, metadata such as author and date. With three or more items, a line is clearer than a gap alone. Don't put one between every word, or between items that already have borders.
How tall should a vertical separator be?
As tall as its row: give the parent a height (h-5) and items-center, and the Separator stretches to fill it. Match the row to the text line, or slightly taller. A height class on the Separator itself works too, but then each line needs it.
How much space should sit on each side?
gap-4 on the flex row gives a 16 pixel pause on both sides, as here; gap-2 suits compact navigation. Keep it even so the line reads as a divider, not a margin on one item.
Why set orientation to vertical explicitly?
The default is horizontal, which draws a full-width line. orientation="vertical" switches the line to one pixel wide and full height, and tells assistive tech the orientation.
Related
- Horizontal SeparatorA horizontal separator that divides a
- In Navigation SeparatorVertical separators between navigation
- Menu SeparatorVertical separators between menu items
- Simple Line SeparatorA single horizontal separator with its
- Breadcrumb with Ellipsis (Standard)A breadcrumb trail with a text Home link
- Standard CardA basic card with a title, a description