Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Separator examples · Spacing

Tight Spacing Separator for React

A horizontal separator in a flex column with a 4 pixel gap for compact lists.

Framework
UI library

Keep related rows grouped. This React Separator sits in a flex column with gap-1, so the line divides the rows without a section-sized pause. Use it for list items, settings rows and mobile stacks where vertical space is scarce.

Preview

Preview width

Inbox

Drafts

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 tight spacing?

For dense lists, sidebar rows and mobile stacks. When the items are siblings in one group, a 4 pixel gap plus a one-pixel line is enough; use wider gaps when they're different sections.

Does tight spacing work better on mobile?

Often, because more content fits on screen. Keep interactive rows at least 44 pixels tall, though: the gap doesn't make a hit area bigger.

Does tight spacing hurt accessibility?

Screen readers ignore visual gaps. People with low vision still need contrast on the line and a clear type hierarchy, so test the layout at 200 percent zoom.

Should tight spacing open up on desktop?

Use gap-1 md:gap-4 when the same list becomes a roomy settings page on large screens. Keep it tight everywhere for data-dense dashboards.

Why gap instead of space-y?

space-y-* adds margins to the children, which can collapse with margins already on them; a flex gap spaces the rows and the line evenly and doesn't depend on the children.

Should the line get thinner in a tight stack?

No. Keep the one-pixel line in the border color; the weight comes from spacing, not a second thickness.