Containment · Material 3: Divider
Divider
Separates groups. In Minimal it's space by default; a faint tint line when a list needs a visible break.
Examples and variants
Space and tint
First divider is space, second is a tint.
Account
Billing
Danger zone
function DividerBasic() {
return (
<div className="flex w-full max-w-sm flex-col text-sm">
<p>Account</p>
<Separator />
<p>Billing</p>
<Separator variant="tint" />
<p>Danger zone</p>
</div>
)
}Spec drawing
Measured from the live component at default density. Each code maps to the token that sets it; change the token and the drawing follows.
Install
With the CLI
The shadcn CLI only delivers files: it copies our code from the Isotopi registry into your project and installs the packages it uses. Add the foundation once, then the component.
npx shadcn@latest add https://isotopi.com/r/minimal.json
npx shadcn@latest add https://isotopi.com/r/separator.jsonBy hand
No CLI needed. Add the foundation once (see Getting started), then follow these steps. They include every component this one builds on.
Install the packages it uses.
Terminalnpm install @base-ui/react cnCopy this file to the same paths in your project. Imports use the
@/alias for your project root.components/ui/separator.tsxseparator
components/ui/separator.tsx"use client" import { Separator as SeparatorPrimitive } from "@base-ui/react/separator" import { cn } from "cn" /* Divider. Minimal draws no lines: - variant="space" (default): an empty gap of --divider-space. - variant="tint": a faint --divider-thickness line in --divider-color, centred in the same gap, for dense lists that need a visible break. */ function Separator({ className, orientation = "horizontal", variant = "space", ...props }: SeparatorPrimitive.Props & { variant?: "space" | "tint" }) { return ( <SeparatorPrimitive data-slot="separator" data-variant={variant} orientation={orientation} className={cn( "shrink-0 bg-clip-content data-horizontal:h-(--divider-space) data-horizontal:w-full data-vertical:w-(--divider-space) data-vertical:self-stretch", variant === "tint" ? "bg-(--divider-color) data-horizontal:py-[calc((var(--divider-space)-var(--divider-thickness))/2)] data-vertical:px-[calc((var(--divider-space)-var(--divider-thickness))/2)]" : "bg-transparent", className )} {...props} /> ) } export { Separator }
Imports
What the examples on this page import:
import { Separator } from "@/components/ui/separator"Anatomy
- 1Divider · --divider-space; tint uses --divider-thickness and --divider-color.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "space" | "tint" | "space" | Gap only, or a faint line. |
orientation | "horizontal" | "vertical" | "horizontal" | Direction. |
Tokens
Every visual spec is a component token in styles/tokens/components.css, pointing at a semantic token. Change a token to restyle the component; themes change the semantic layer.
| Token | Points to | Light | Dark |
|---|---|---|---|
--divider-thickness | var(--stroke-width-thin) | 1px | same |
--divider-color | var(--stroke-color-subtle) | oklch(0.22 0.01 260 / 16%) | oklch(1 0 0 / 8%) |
--divider-space | var(--space-gap-stack-lg) | 24px | same |
Motion
| Trigger | What happens | Tokens |
|---|---|---|
| None | Static. | — |
Calm keeps the motion without overshoot. Still (and reduced motion) keeps a designed frame with no movement.
Accessibility
- role=separator when it carries meaning.
Usage
Do
- Prefer space.
Don’t
- Don't draw lines between every row.
Code
"use client"
import { Separator as SeparatorPrimitive } from "@base-ui/react/separator"
import { cn } from "cn"
/*
Divider. Minimal draws no lines:
- variant="space" (default): an empty gap of --divider-space.
- variant="tint": a faint --divider-thickness line in --divider-color,
centred in the same gap, for dense lists that need a visible break.
*/
function Separator({
className,
orientation = "horizontal",
variant = "space",
...props
}: SeparatorPrimitive.Props & { variant?: "space" | "tint" }) {
return (
<SeparatorPrimitive
data-slot="separator"
data-variant={variant}
orientation={orientation}
className={cn(
"shrink-0 bg-clip-content data-horizontal:h-(--divider-space) data-horizontal:w-full data-vertical:w-(--divider-space) data-vertical:self-stretch",
variant === "tint"
? "bg-(--divider-color) data-horizontal:py-[calc((var(--divider-space)-var(--divider-thickness))/2)] data-vertical:px-[calc((var(--divider-space)-var(--divider-thickness))/2)]"
: "bg-transparent",
className
)}
{...props}
/>
)
}
export { Separator }