Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Separator examples · Basic

In Navigation Separator for React

Vertical separators between navigation links in a fixed-height row.

Framework
UI library

Keep header links readable without boxing each one. This React Separator sits between links in an h-5 flex row, set to orientation="vertical", so each line takes its height from the row. Use it for utility navigation, footer link rows and compact header clusters.

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

Why set the height on the row instead of each separator?

A vertical Separator stretches to the height of its parent, so one h-5 on the nav sizes every line at once, and they always match the row. A height on each separator works too, but has to be repeated and kept in sync.

How much space belongs between links and separators?

gap-2 (8 pixels) keeps a compact header; gap-4 suits sparse utility links. Use flex gap rather than space-x-*: it spaces the links and the lines evenly, with no margins to fight.

When should nav use separators instead of borders or spacing?

When several inline links start to blur together and you want a lighter cue than button borders. Breadcrumbs usually take a chevron, not a line, and stacked mobile menus don't need vertical separators at all.

Should the separator change when a link is hovered?

No. The line is structure and the link is the target: hover and focus styles stay on the links.

Should these separators show on mobile?

While the links stay in a row, yes. When the menu stacks into full-width items, hide the separators: a vertical line between stacked items is noise.

Are nav separators accessible?

The links sit in a nav landmark with an aria-label, and the separators never take focus, so keyboard users move from link to link. The lines are exposed as separators and can be announced between links; if that's noise for your users, a border on each link is quieter.