$npx @dinachi/cli@latest add separator
Dinachi UI
An accessible component library.
Docs
Source
Blog
orientationlinksproject-links.tsx
import { Separator } from "@/components/ui/separator"
export function ProjectLinks() {
return (
<div className="w-full max-w-sm">
<div className="space-y-1">
<h4 className="text-sm font-medium">Dinachi UI</h4>
<p className="text-sm text-muted-foreground">An accessible component library.</p>
</div>
<Separator className="my-4" />
<div className="flex h-5 items-center space-x-4 text-sm">
<div>Docs</div>
<Separator orientation="vertical" />
<div>Source</div>
<Separator orientation="vertical" />
<div>Blog</div>
</div>
</div>
)
}Usage
import { Separator } from "@/components/ui/separator"
export function Section() {
return (
<div>
<p>Account</p>
<Separator className="my-4" />
<p>Billing</p>
</div>
)
}Examples
Dinachi UI
An accessible component library.
Docs
Source
Blog
Divides a heading from a row of links.
import { Separator } from '@/components/ui/separator';
export function Example() {
return (
<div className="w-full max-w-sm">
<div className="space-y-1">
<h4 className="text-sm font-medium">Dinachi UI</h4>
<p className="text-sm text-muted-foreground">
An accessible component library.
</p>
</div>
<Separator className="my-4" />
<div className="flex h-5 items-center space-x-4 text-sm">
<div>Docs</div>
<Separator orientation="vertical" />
<div>Source</div>
<Separator orientation="vertical" />
<div>Blog</div>
</div>
</div>
);
}Horizontal
Item AItem BItem C
Horizontal and vertical lines.
import { Separator } from '@/components/ui/separator';
export function Example() {
return (
<div className="space-y-6 w-full max-w-sm">
<div>
<p className="text-sm font-medium mb-2">Horizontal</p>
<Separator />
</div>
<div className="flex items-center space-x-4 h-8">
<span className="text-sm">Item A</span>
<Separator orientation="vertical" />
<span className="text-sm">Item B</span>
<Separator orientation="vertical" />
<span className="text-sm">Item C</span>
</div>
</div>
);
}Notes
Vertical height
A vertical separator is h-full. Give the row a height, as in <div className="flex h-5 items-center">, or the line collapses.
Decorative lines
Separator always has the separator role. For a purely visual line, use a styled div so screen readers skip it.
API
orientation"horizontal" | "vertical" = "horizontal"
Horizontal fills the width; vertical fills the height.renderReactElement
Swap the element, keep the behaviour.Accessibility
- Renders with the separator role and aria-orientation set from
orientation.