Separator
A visual divider between content sections with horizontal/vertical orientation, label support, and multiple style variants.
Basic
A visual separator line used to divide content into distinct sections. Built on Radix UI's Separator primitive with design system tokens.
Content above
Content below
Installation
Install the component via the CLI in one command.
npx @work-rjkashyap/unified-ui add separatorpnpm dlx @work-rjkashyap/unified-ui add separatornpx @work-rjkashyap/unified-ui add separatorbunx @work-rjkashyap/unified-ui add separatorIf you haven't initialized your project yet, run npx @work-rjkashyap/unified-ui init first. See the CLI docs for details.
Or install the full package
Use this approach if you prefer to install the entire design system as a dependency instead of copying individual components.
npm install @work-rjkashyap/unified-uipnpm add @work-rjkashyap/unified-uiyarn add @work-rjkashyap/unified-uibun add @work-rjkashyap/unified-uiAnatomy
import { Separator } from "@work-rjkashyap/unified-ui";Examples
Horizontal (default)
The default orientation is horizontal — a full-width line with vertical margin.
Vertical
Use orientation="vertical" for inline dividers — for example, between toolbar items or navigation links. The parent must have a defined height (e.g. flex with items-center).
Variants
Four visual variants to match different contexts.
| Variant | Description |
|---|---|
default | Solid line using the border token color. |
muted | Lighter line at reduced opacity. |
dashed | Dashed border style for a softer division. |
gradient | Fades from transparent at edges through the center. |
Spacing
Control the margin around the separator using the spacing prop with the Tailwind spacing scale.
| Spacing | Horizontal Margin | Vertical Margin |
|---|---|---|
0 | my-0 | mx-0 |
1 | my-1 | mx-1 |
2 | my-2 | mx-2 |
3 | my-3 | mx-3 |
4 | my-4 (default) | mx-4 |
5 | my-5 | mx-5 |
6 | my-6 | mx-6 |
8 | my-8 | mx-8 |
10 | my-10 | mx-10 |
12 | my-12 | mx-12 |
With Label
Pass a label prop to render centered text on the separator — useful for "or" dividers, section breaks, and form layouts. Labels are only supported with horizontal orientation.
Labeled with Gradient
Real-World Examples
Settings Section Divider
Login Form Divider
Toolbar Divider
Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "muted" | "dashed" | "gradient" | "default" | Visual style of the separator line. |
orientation | "horizontal" | "vertical" | "horizontal" | Direction of the separator. |
decorative | boolean | true | When true, hidden from assistive technology. When false, renders as a semantic separator. |
spacing | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 4 | Margin around the separator (vertical for horizontal, horizontal for vertical). |
label | ReactNode | — | Optional centered label text. Only supported for horizontal orientation. |
className | string | — | Additional CSS classes. |
All standard HTML attributes are forwarded to the underlying Radix UI Separator.Root element.
Accessibility
Most separators are purely decorative. Only set decorative={false} when the
separator conveys meaningful structure (e.g., separating form sections that a
screen reader should announce).
decorative={true}(default) — Renders withrole="none", completely hidden from assistive technology. Use this for visual-only dividers.decorative={false}— Renders withrole="separator"andaria-orientation, making it visible to screen readers as a structural boundary.- Label text — When a
labelis provided, the text is visible but does not affect semantics whendecorativeistrue. For non-decorative labeled separators, the wrapper receives the separator role.
Separator vs. Divider
The design system includes both a Separator component (in the components layer) and a Divider primitive (in the primitives layer):
| Feature | Separator | Divider |
|---|---|---|
| Layer | Components | Primitives |
| Built on | Radix UI Separator | Native <hr> element |
| Variants | default, muted, dashed, gradient | None |
| Labels | ✅ Supported | ❌ Not supported |
| Decorative | ✅ Radix-managed role | Relies on aria-orientation |
| Use case | Rich dividers with labels and variants | Simple spacing lines |
Use Separator when you need variant styling, labels, or Radix-level accessibility semantics. Use Divider for simple, lightweight spacing lines in layout primitives.
Design Tokens
| Token | Usage |
|---|---|
--border | Default separator line color |
--muted-foreground | Muted variant and label text color |