Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Tight Spacing Separator for Solid

A horizontal line between Inbox and Drafts, with only a 4 pixel gap on each side of the line.

UI library: Ark UI

Inbox sits above a horizontal line, and Drafts sits below it. The gap on each side is 4 pixels, so the rows stay tight.

Use the tight gap for list rows and dense settings. Open the space, or move the groups into Tabs, when they are really different sections. In Solid, Ark UI leaves the gap to the parent.

Preview

Preview width

Installation

MCP · Pro
Make your AI a shadcn expert
Your agent installs components, builds pages and restyles your app from one prompt, in Claude Code, Cursor or VS Code.
Part of Pro

Anatomy

Separator anatomy: horizontal, vertical

Usage

<div class="flex w-full max-w-sm flex-col gap-1">
    <p class="text-sm">Inbox</p>
    <Separator />
    <p class="text-sm">Drafts</p>
  </div>

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.

API Reference

Separator

No extra props in this demo. The rest is on the Separator page.