Components
Separator
A thin divider, decorative by default.
Zuri
Components you own.
DocsRegistrySource
Use Separator to divide groups of content. If the division is already clear from headings or spacing, you don't need one.
Installation
pnpm dlx shadcn@latest add https://components.abdulqadirmsingi.com/r/separator.json
Usage
import { Separator } from "@/components/ui/separator";
<Separator className="my-4" />
<div className="flex h-5 items-center gap-3">
Docs <Separator orientation="vertical" /> Source
</div>A vertical separator stretches to its parent's height, so the parent needs one.
Props
Separator extends all native <div> props and spreads them onto the element, including ref (React 19).
| Prop | Type | Default | Description |
|---|---|---|---|
| orientation | "horizontal" | "vertical" | "horizontal" | Direction of the line. |
| decorative | boolean | true | When true it is hidden from assistive technology. Set false if it marks a real boundary between sections. |
| className | string | – | Merged with the built-in classes; yours win on conflicts. |
Accessibility
- By default it has
role="none", so screen readers skip it. - With
decorative={false}it is aseparator, and a vertical one also reportsaria-orientation="vertical"(horizontal is the default). - It is a hairline, not an interactive control, so it is not held to the 3:1 contrast rule for control boundaries.
Tokens used
--border.
Known limitations
- It is a
div, not an<hr>, so it does not appear in "thematic break" navigation unlessdecorative={false}.
Source
import type { ComponentProps } from "react";import { cn } from "@/lib/utils";export interface SeparatorProps extends ComponentProps<"div"> { orientation?: "horizontal" | "vertical"; /** Purely visual: hidden from assistive technology. Defaults to true. */ decorative?: boolean;}/** A thin dividing line. Vertical separators need a parent with a height (e.g. `h-6`). */export function Separator({ orientation = "horizontal", decorative = true, className, ...props}: SeparatorProps) { return ( // biome-ignore lint/a11y/useAriaPropsSupportedByRole: the role is dynamic; aria-orientation is only set when it is "separator". <div role={decorative ? "none" : "separator"} // aria-orientation is only meaningful (and only valid) on a real separator. aria-orientation={!decorative && orientation === "vertical" ? "vertical" : undefined} className={cn( "shrink-0 bg-border", orientation === "horizontal" ? "h-px w-full" : "h-full w-px self-stretch", className, )} {...props} /> );}