Separator
A dividing line between sections. Renders an hr.
import { Separator } from "antlitz";
API
| Prop | Type | Default |
|---|---|---|
| decorative | boolean | false |
| orientation | "horizontal" | "vertical" | horizontal |
Horizontal
Above
Below
export function Horizontal() {
return (
<>
<Text size="sm">Above</Text>
<Separator />
<Text size="sm">Below</Text>
</>
);
}Vertical
Left
Middle
Right
export function Vertical() {
return (
<div className="flex h-5 items-center gap-4">
<Text size="sm">Left</Text>
<Separator orientation="vertical" />
<Text size="sm">Middle</Text>
<Separator orientation="vertical" />
<Text size="sm">Right</Text>
</div>
);
}A vertical separator needs a parent with a resolved height — it is h-full, so
it collapses inside a container that sizes to its content.
Decorative
Removed from the accessibility tree
Purely visual
export function Decorative() {
return (
<>
<Text size="sm">Removed from the accessibility tree</Text>
<Separator decorative />
<Text size="sm">Purely visual</Text>
</>
);
}decorative sets role="none" and aria-hidden, removing the rule from the
accessibility tree. Use it when the line is purely visual and the sections
either side are already distinguished by headings or landmarks.
Leave it off when the rule is the only thing separating two groups of content,
where its implicit separator role carries meaning.