Divider
A rule between things, horizontal or vertical.
Examples
Playground
Above the rule.
Below the rule.
Spacing
The space above and below the rule, on the stack scale.
Above the rule.
Below the rule.
Above the rule.
Below the rule.
Above the rule.
Below the rule.
Above the rule.
Below the rule.
Vertical
Between items in a row. Decorative by default there, so it is not announced.
Rename
Delete
Install
npx shadcn add @hipuku/dividerUsage
import { Divider } from '@/components/haus/components/Divider'
<Divider spacing="md" />API
Divider also takes its element's own attributes and forwards its ref. className lands on the
hr.
| Prop | Type | Description |
|---|---|---|
orientation | "horizontal" | "vertical" | |
spacing | "none" | "sm" | "md" | "lg" | |
decorative | boolean | A rule that is only a rule. A separator between two groups is structure, and a screen reader should announce it. A line drawn because a panel looked crowded is not, and announcing it is noise. Nothing in the markup distinguishes them, so the caller says which this is; the default is the meaningful one, because a separator wrongly announced is a smaller failure than a structural break that is invisible. |
Spacing
spacing sets the room on either side: sm, md or lg, or none. A vertical divider takes it
on either side horizontally, and stretches to the height of the row it sits in.
Decorative or not
By default a Divider is announced as a separator between two groups. Set decorative when the
line is only visual, such as one drawn to break up a dense panel, and it is hidden from screen
readers.
Accessibility
- Always an
<hr>, so it is a break even with styles off. - Not interactive.