Skip to content
shadcn.io

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.

Framework
UI library

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

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 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.

What flex settings work with vertical separators?

flex items-center gap-4 on the row, with an explicit height. items-center keeps the text centered next to the line, and gap spaces lines and items evenly where space-x-* margins wouldn't.

Are vertical separators announced to screen readers?

Yes: each line has role separator with a vertical aria-orientation. For purely visual dividers in a long row, a border on the items is quieter.