A semantic or decorative divider with horizontal, vertical, and centered-label layouts.
Keep track of the latest changes.
Your team approved the new layout.
import { Separator } from "@/components/ballmac/separator"
export default function SeparatorDemo() {
return (
<div className="w-full max-w-sm rounded-xl border bg-card p-5 shadow-sm">
<div className="text-sm font-semibold">Project activity</div>
<p className="mt-1 text-xs text-muted-foreground">
Keep track of the latest changes.
</p>
<Separator label="Today" className="my-5" />
<div className="text-sm">Design review completed</div>
<p className="mt-1 text-xs text-muted-foreground">
Your team approved the new layout.
</p>
</div>
)
}Installation
The default, and what a Radix-style project installs.
$ pnpm dlx shadcn@latest add @ballmac/separatorInstall the dependencies.
$ pnpm add radix-uiCopy the source into your project.
components/ballmac/separator.tsx// Ballmac UI: Separator. https://ui.ballmac.com/components/separator // Based on shadcn/ui Separator (MIT, Copyright (c) 2023 shadcn), adding an optional centered label. import * as React from "react" import { Separator as SeparatorPrimitive } from "radix-ui" import { cn } from "@/lib/utils" type SeparatorProps = React.ComponentProps<typeof SeparatorPrimitive.Root> & { /** Short text displayed in the middle of a horizontal separator. */ label?: string } function Separator({ className, orientation = "horizontal", decorative = true, label, ...props }: SeparatorProps) { if (label && orientation === "horizontal") return ( <div data-slot="separator-labeled" role={decorative ? "presentation" : "separator"} className={cn( "text-muted-foreground flex w-full items-center gap-3 text-xs", className, )} {...props} > <span aria-hidden="true" className="bg-border h-px min-w-0 flex-1" /> <span>{label}</span> <span aria-hidden="true" className="bg-border h-px min-w-0 flex-1" /> </div> ) return ( <SeparatorPrimitive.Root data-slot="separator" decorative={decorative} orientation={orientation} className={cn( "bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px", className, )} {...props} /> ) } export { Separator, type SeparatorProps }Update the import paths to match your project setup.
$ pnpm dlx shadcn@latest add https://ui.ballmac.com/r/base/separator.jsonInstall the dependencies.
$ pnpm add @base-ui/react@^1.9.0Copy the source into your project.
components/ballmac/separator.tsx// Ballmac UI: Separator. https://ui.ballmac.com/components/separator // Based on shadcn/ui Separator (MIT, Copyright (c) 2023 shadcn), adding an optional centered label. import * as React from "react" import { Separator as SeparatorPrimitive } from "@base-ui/react/separator" import { cn } from "@/lib/utils" type SeparatorProps = Omit<React.ComponentProps<typeof SeparatorPrimitive>, "className"> & { className?: string /** A decorative separator is hidden from assistive technology. Set false when it divides content people should know is divided. */ decorative?: boolean /** Short text displayed in the middle of a horizontal separator. */ label?: string } function Separator({ className, orientation = "horizontal", decorative = true, label, ...props }: SeparatorProps) { if (label && orientation === "horizontal") return ( <div data-slot="separator-labeled" role={decorative ? "presentation" : "separator"} className={cn( "text-muted-foreground flex w-full items-center gap-3 text-xs", className, )} {...(props as React.ComponentProps<"div">)} > <span aria-hidden="true" className="bg-border h-px min-w-0 flex-1" /> <span>{label}</span> <span aria-hidden="true" className="bg-border h-px min-w-0 flex-1" /> </div> ) const classes = cn( "bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px", className, ) // Base UI's separator always says "separator". A decorative one is a plain element with no role, as before. if (decorative) return <div data-slot="separator" role="none" data-orientation={orientation} className={classes} {...(props as React.ComponentProps<"div">)} /> return <SeparatorPrimitive data-slot="separator" orientation={orientation} className={classes} {...props} /> } export { Separator, type SeparatorProps }Update the import paths to match your project setup.
Usage
import { Separator } from "@/components/ballmac/separator"The full example is in the Code tab above.
Examples
States and variants
import { Separator } from "@/components/ballmac/separator"
export default function SeparatorStates() {
return (
<div className="flex w-full max-w-sm items-center gap-4 rounded-xl border bg-card p-5 text-sm">
<span>Overview</span>
<Separator orientation="vertical" className="h-5" />
<span>Activity</span>
<Separator orientation="vertical" className="h-5" />
<span>Settings</span>
</div>
)
}API reference
| Prop | Type | Default |
|---|---|---|
labelShort text displayed in the middle of a horizontal separator. | string | — |
Also accepts the standard attributes of its root element.
Quality scorecard
Every applicable check passes
Measured in Chromium 153.0.8010.12 on October 19, 2026, on version 1.0.0, across 2 examples.
Passed: Accessibility scan
No serious or critical issues in light and dark, on a phone and a desktop (axe-core 4.13.0, WCAG 2.1 AA and best-practice rules).
Passed: Small screens
No sideways scrolling at 360, 390 or 1280 px wide.
Passed: Reduced motion
No endless animation to begin with.
Passed: Right to left
Mirrors correctly in Arabic, Hebrew, Persian and Urdu layouts (0% of elements off the mirror, limit 15%).
Passed: Clean console
No console errors or React hydration errors while loading.
Not applicable: Keyboard
Static content: nothing to focus.
Not applicable: Loading, empty and error
Does not show data or take submissions.
For information: Automated tests
No test file of its own yet.
For information: Footprint
0.6 KB of source (gzip) in 1 file. Installs radix-ui.
Automated checks find a subset of problems and do not replace testing with a screen reader and a keyboard in your own app. What they miss.
Use with AI
A semantic or decorative divider with horizontal, vertical, and centered-label layouts. With the shadcn MCP server set up (guide), ask your agent:
Add the Ballmac UI Separator (@ballmac/separator) to this project with the shadcn MCP, then use it where it fits.
Use it for
- Separate groups of related content
- Divide a form with a short label
Not for
- Use spacing alone when separation is already clear
Registry JSON: https://ui.ballmac.com/r/separator.json
Credits
Based on shadcn/ui Separator, adapted by Ballmac. Free to use in personal and commercial projects.
- npm
- radix-ui
- Registry
- shadcn/utils
Pairs well with
Card
A composable content surface with compact spacing, an action slot, and optional interactive feedback.
App Shell
The frame of an application page: skip link, sticky header, sidebar that becomes a sheet on small screens, main area, optional aside and footer.
Aspect Ratio
A CSS-native ratio frame that reserves space for media and safely handles invalid ratio values.
Bento Grid
A responsive bento layout of feature cards that span columns and rows. Each BentoCard has a background visual slot, icon, title and description, and a link that slides up on hover or focus.
Ballmac UI Pro
Need the whole screen, not one piece?
311 premium blocks (dashboards, settings, calendars, mail, shops, onboarding), a private shadcn registry and Figma tokens. Blocks that show data come with loading, empty and error states built in.
Not ready? Try three Pro blocks free
Leave your email and the blocks appear right here, ready to copy. Yours to use in any project.