Get Started
Components
- Accordion
- Attachment
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Card
- Checkbox
- Code Block
- Collapsible
- Dialog
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Label
- Marker
- Message
- Number Flow
- Pagination
- Popover
- Progress
- Radio Group
- Select
- Slider
- Sonner
- Spinner
- Switch
- Tooltip
- Separator
- Sheet
- Tabs
- Textarea
- Toggle
- Toggle Group
- Trace
AI Elements
Libraries
Utilities
frakment
Primitives for AI interfaces
A set of beautifully designed components you can customize, extend, and build on —.
"use client";
import type * as React from "react";
import { cn } from "@/lib/utils";
export interface SeparatorProps extends React.HTMLAttributes<HTMLDivElement> {
decorative?: boolean;
orientation?: "horizontal" | "vertical";
}
function Separator({
className,
orientation = "horizontal",
decorative = true,
...props
}: SeparatorProps) {
return (
<div
aria-orientation={decorative ? undefined : 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
)}
data-orientation={orientation}
data-slot="separator"
role={decorative ? "none" : "separator"}
{...props}
/>
);
}
export { Separator };A div-based divider. Horizontal by default, vertical with orientation="vertical". When decorative is true (the default) it renders with role="none". Set decorative={false} when the divider carries structural meaning and should be announced to assistive tech.
Installation
$ bunx --bun frakment add separator$ npx frakment add separator$ pnpm dlx frakment add separator$ yarn dlx frakment add separator
Copy and paste the following code into your project.
"use client";
import type * as React from "react";
import { cn } from "@/lib/utils";
export interface SeparatorProps extends React.HTMLAttributes<HTMLDivElement> {
decorative?: boolean;
orientation?: "horizontal" | "vertical";
}
function Separator({
className,
orientation = "horizontal",
decorative = true,
...props
}: SeparatorProps) {
return (
<div
aria-orientation={decorative ? undefined : 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
)}
data-orientation={orientation}
data-slot="separator"
role={decorative ? "none" : "separator"}
{...props}
/>
);
}
export { Separator };Update the import paths to match your project setup.
Usage
import { Separator } from "@/components/ui/separator";<Separator />;Vertical
DocsSourceDesign
import { Separator } from "@/components/ui/separator";
export function SeparatorVertical() {
return (
<div className="flex h-5 items-center gap-4 text-sm">
<span>Docs</span>
<Separator orientation="vertical" />
<span>Source</span>
<Separator orientation="vertical" />
<span>Design</span>
</div>
);
}Pass orientation="vertical". The divider fills its parent height and sets width to 1px. Use it inside a flex container with a fixed height.
<div className="flex h-5 items-center gap-4 text-sm">
<span>Docs</span>
<Separator orientation="vertical" />
<span>Source</span>
</div>Semantic
Section one
Section two
import { Separator } from "@/components/ui/separator";
export function SeparatorDecorative() {
return (
<div className="flex w-full max-w-xs flex-col gap-4 text-sm">
<p>Section one</p>
<Separator decorative={false} />
<p>Section two</p>
</div>
);
}decorative={false} renders role="separator" with aria-orientation. Use it when the divider communicates structure that a screen reader should announce. Default true hides the divider from the accessibility tree.
<Separator decorative={false} />;API Reference
Separator
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | horizontalvertical | horizontal | Divider direction. |
decorative | boolean | true | When true, renders role=none and hides from assistive tech. When false, role=separator with aria-orientation. |
className | string | — | Additional CSS classes merged with cn(). |
Accessibility
- Default
decorative={true}rendersrole="none", so screen readers skip the divider. decorative={false}rendersrole="separator"andaria-orientationso the divider becomes part of the document structure.- Do not attach
aria-labelto a decorative separator. It is invisible to assistive tech by design.
Best Practices
- Use decorative by default. Only opt into
decorative={false}when the divider encodes structural meaning. - Prefer spacing over separators. Gap or padding on the parent often reads better than a hard line.
- Keep vertical separators short. They work best inside inline rows (navigation, breadcrumbs, meta info).
Related Components
- Button Group: uses Separator between buttons
- Item: list item layout with optional separator
- Theming: customize the border token