Separator and Divider for React
A React separator for hairline dividers, horizontal or vertical, solid, fading or dashed, with an optional label. Use it as a React divider between groups in a settings page, such as Account and Notifications, where a fading or solid hairline gives the page rhythm without adding another card.
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/separator.json- or
Variants and orientation
Vertical separators stretch to the height of their row.
import { Separator } from "@/components/sheenui/separator/separator";
// Package build (after the first npm release, or a packed tarball): import { Separator } from "@sheenui/theme";
export function Example() {
return (
<>
{/* "line" is a hairline, "fade" fades out at both ends */}
{(["line", "fade", "dashed"] as const).map((variant) => (
<div key={variant} className="flex flex-col gap-2">
<span className="text-xs">variant="{variant}"</span>
<Separator variant={variant} />
</div>
))}
<div className="flex h-5 items-center gap-3">
<a href={"/docs"}>Docs</a>
<Separator orientation="vertical" />
<a href={"/blog"}>Blog</a>
<Separator orientation="vertical" variant="fade" />
<a href={"/changelog"}>Changelog</a>
</div>
</>
);
}Files to copy
3 folders · 1 file · 4 packages
- From
theme/src/ components/separator/lib/cn.tsstyles/
- shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/separator.jsonRegistry item: separator. The styles need the Tailwind v4 glass UI setup.- The examples also use
components/button/components/input/components/spinner/hooks/{use-latest.ts, use-magnetic.ts, use-media-query.ts, use-preferences.ts}motion/{gate.ts, tokens.ts}lib/{field-size.ts, form.ts, state-light.tsx}
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/button.json https://lokendra-builds.github.io/sheenui/r/input.json- Packages
pnpm add @base-ui/react clsx motion tailwind-merge
Labeled
A label in the middle (“or”), in a glass pill, or at the start of the line. Screen readers hear the label as the separator's name.
or
Today
Three new messages from the design team.
Advanced
Experimental options live below this line.
End of results
import { Button } from "@/components/sheenui/button/button";
import { Input } from "@/components/sheenui/input/input";
import { Separator } from "@/components/sheenui/separator/separator";
// Package build (after the first npm release, or a packed tarball): import { Button, Input, Separator } from "@sheenui/theme";
import { Code as GithubIcon, Globe as GoogleIcon } from "lucide-react";
// This example also uses button, input: npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/button.json https://lokendra-builds.github.io/sheenui/r/input.json
export function Example() {
return (
<>
<Button variant="glass" fullWidth leading={<GoogleIcon />}>Continue with Google</Button>
<Button variant="glass" fullWidth leading={<GithubIcon />}>Continue with GitHub</Button>
<Separator label="or" variant="fade" />
<Input label="Email" type="email" />
<Separator label="Today" labelVariant="pill" />
<Separator label="Advanced" labelAlign="start" />
</>
);
}Separator
Keyboard
Accessibility
- role="separator" with the matching orientation; a separator with a label keeps its text readable and its children are presentational to assistive tech.
- Use a decorative separator only to group visually; it does not replace headings or landmarks.
When to use Separator
- Use it to split a toolbar into clusters with a vertical hairline, or to divide Account from Notifications settings with a fading rule and a centered label, instead of nesting another card.
- Use a labeled separator with the word or between a password form and social sign-in buttons, with labelVariant="pill" when the label should sit in a small glass chip.
- Use orientation="vertical" between items in a row, such as a toolbar of stats or a footer's links, where the line stretches to the height of its row.
- Skip it when the break is structural and a screen reader user should find it; use a real heading or landmark, because a decorative separator does not replace either.
- Pair it with GlassCard to divide its sections, Toolbar, which has its own ToolbarSeparator for control groups, and Menu for dividing action groups in a dropdown.
Frequently asked questions
Related pages
67 components pages in all: browse them on All components.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .