When to use
- Split a panel into sections where spacing alone doesn't read, such as above a footer.
- Offer alternatives side by side with a labelled rule, like the "or" between sign-in methods.
- Line a rule up with a list's text column, past its icons or avatars, with
inset. - Divide items in a toolbar or footer row with a vertical rule.
When not to use
Installation
pnpm dlx shadcn add https://eased.dev/r/separator.jsonnpx shadcn add https://eased.dev/r/separator.jsonyarn dlx shadcn add https://eased.dev/r/separator.jsonbunx --bun shadcn add https://eased.dev/r/separator.jsonThe command adds Separator, everything it builds on and Eased’s tokens to your project.
Install the dependencies
pnpm add @base-ui/reactnpm install @base-ui/reactyarn add @base-ui/reactbun add @base-ui/reactAdd the Eased pieces it builds on
Copy each item’s files the same way, or install them with the CLI:
Copy the source into your project
components/eased/separator/separator.tsxTSX import { Separator as BaseSeparator } from "@base-ui/react/separator";import type { ReactNode } from "react";export type SeparatorProps = { /** Default "horizontal". A vertical separator stretches to its row's height. */ orientation?: "horizontal" | "vertical"; /** * subtle (default) between sections on a surface; default where the rule must read on a * sunken or tinted fill (rule 18). */ tone?: "subtle" | "default"; /** * Inset from the leading edge, to line up with content that starts after an icon or avatar * (a list's text column). A length such as "2.5rem" or a CSS variable. Horizontal only. */ inset?: string; /** * Purely visual: hidden from assistive tech. Use it when spacing or a heading already * separates the content; leave it off when the rule is the only thing marking a boundary. */ decorative?: boolean; /** A label in the middle of the rule, like the "or" between sign-in methods. Horizontal only. */ children?: ReactNode; className?: string;};const TONE = { subtle: "bg-line-subtle", default: "bg-line" } as const;/** * A 1px rule in Eased's line colours, horizontal or vertical, optionally inset to a content * column or labelled ("or"). Base UI's Separator supplies `role="separator"` and * `aria-orientation`; decorative rules are hidden from assistive tech instead. */export function Separator({ orientation = "horizontal", tone = "subtle", inset, decorative = false, children, className = "" }: SeparatorProps) { const a11y = decorative ? { role: "none", "aria-hidden": true as const } : {}; if (orientation === "vertical") { return <BaseSeparator orientation="vertical" {...a11y} className={`w-px shrink-0 self-stretch ${TONE[tone]} ${className}`} />; } if (children != null) { // A string label names the separator ("or, separator"); the visible copy is not read twice. return ( <BaseSeparator orientation="horizontal" aria-label={!decorative && typeof children === "string" ? children : undefined} {...a11y} className={`flex min-w-0 items-center gap-3 text-ui-xs text-text-muted ${className}`} > <span aria-hidden className={`h-px min-w-4 flex-1 ${TONE[tone]}`} /> <span aria-hidden={typeof children === "string" || undefined} className="shrink-0"> {children} </span> <span aria-hidden className={`h-px min-w-4 flex-1 ${TONE[tone]}`} /> </BaseSeparator> ); } return ( <BaseSeparator orientation="horizontal" {...a11y} style={inset ? { marginInlineStart: inset } : undefined} className={`h-px shrink-0 ${TONE[tone]} ${className}`} /> );}Keep the folder layout
The files import each other by relative path (
../lib/motion), so keep each one at the path shown, undercomponents/eased/.
Usage
import { Button } from "@/components/eased/button/button";import { Input } from "@/components/eased/input/input";import { Separator } from "@/components/eased/separator/separator";export function SignInMethods() { return ( <div className="flex flex-col gap-5"> <Button className="w-full">Continue with Google</Button> <Separator>or</Separator> <Input type="email" aria-label="Work email" placeholder="you@company.com" /> </div> );}Examples
Inset to a text column
Use inset so the rule starts where a list's text does, after a 32px avatar and its gap.
<Separator inset="2.5rem" />Vertical
Use a vertical rule between items in a row. It stretches to the row's height, so give the row a height or the rule a margin.
<div className="flex h-12 items-center gap-3 text-ui-sm text-text-muted"> <span>SSO available on Business</span> <Separator orientation="vertical" decorative className="my-4" /> <span>SOC 2 Type II</span></div>On a tinted fill
Use tone="default" when the rule sits on a sunken or tinted surface, where subtle disappears.
<Separator tone="default" />API reference
Separator
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | "horizontal" | "vertical" | "horizontal" | A vertical rule stretches to its row's height. |
tone | "subtle" | "default" | "subtle" | default reads on sunken or tinted fills. |
inset | string | Leading inset, as a CSS length or variable such as "2.5rem". Horizontal, unlabelled rules only. | |
decorative | boolean | false | Hides the rule from assistive tech. |
children | ReactNode | A label in the middle of the rule, such as "or". Horizontal only. | |
className | string | "" | Appended to the root's classes. |
No other props pass through to Base UI's Separator.
Accessibility
- It renders
role="separator"witharia-orientation, from Base UI. - A string label names the separator through
aria-label("or, separator"), and the visible copy is hidden so it isn't read twice. A non-string label is read as content. decorativesetsrole="none"andaria-hidden. Use it when spacing or a heading already marks the boundary; leave it off when the rule is the only thing that does.
Motion
None. Rules mark structure; they never animate.
Notes for AI
Pick Separator for a single boundary between sections, a labelled "or" between alternatives, or a vertical divider in a row. Pass decorative whenever the rule is only visual, which is most of the time inside cards and footers.
Don't use it between every list row; put divide-y divide-line-subtle on the list instead. Don't pass inset with a label or a vertical orientation, where it has no effect, and don't hand-roll a <hr> or a h-px div: you'd lose the role and the tone tokens.
Responsive
A labelled rule keeps at least 16px of line on each side of its label, so it still reads on a narrow screen. The label itself never shrinks, so keep it to a word or two.
Related components
- Animated Tabs: switch between views rather than divide one.
- Heading Typography Scale: separate sections with a title instead of a rule.
- Markdown Prose Typography