Divider
A horizontal rule used to visually separate content sections.
import { Divider } from '@/components/ui/wideset/divider/Divider';
<div className="w-[20rem] max-w-full">
<Divider text="or" />
</div>Installation
pnpm dlx wideset add divider
Copies the component and any Wideset components it uses into your project.
Examples
Line styles
Solid separates sections that stand on their own. Dashed is lighter and suggests the parts still belong together, such as optional fields under the required ones. The dashes are drawn as an SVG stroke at a fixed 4 px rhythm, so they look the same in every browser.
import { Divider } from '@/components/ui/wideset/divider/Divider';
export default function DividerLineStyles() {
return (
<div className="gap-ws-11 flex w-[20rem] max-w-full flex-col">
<Divider lineStyle="solid" />
<Divider lineStyle="dashed" />
</div>
);
}Weights
Default suits most section breaks. Thin is for separators inside a section, such as between list rows; bold marks a major break, such as the end of a form's main part. A heavier line splits the page more strongly, so use the lightest one that does the job.
import { Divider } from '@/components/ui/wideset/divider/Divider';
export default function DividerWeights() {
return (
<div className="gap-ws-11 flex w-[20rem] max-w-full flex-col">
{(['thin', 'default', 'bold'] as const).map((weight) => (
<Divider key={weight} weight={weight} />
))}
</div>
);
}Emphasis
Emphasis sets the line's contrast. Base is the default. Subtle fades into the surface, for separators that should organise without being noticed; strong stands out, for a break the user must not miss. Weight and emphasis combine, so a thin strong line and a bold subtle one both exist.
import { Divider } from '@/components/ui/wideset/divider/Divider';
export default function DividerEmphasis() {
return (
<div className="gap-ws-11 flex w-[20rem] max-w-full flex-col">
{(['subtle', 'base', 'strong'] as const).map((emphasis) => (
<Divider key={emphasis} emphasis={emphasis} />
))}
</div>
);
}Text align
Centred text joins two alternatives ("or"). Left-aligned text titles the section that follows, like a quiet heading; right is for a trailing note. Long text is cut with an ellipsis rather than wrapping, so keep it to a word or two. The text sits inside a role="separator", which screen readers may skip, so it cannot be the only heading of a section.
import { Divider } from '@/components/ui/wideset/divider/Divider';
export default function DividerTextAlign() {
return (
<div className="gap-ws-11 flex w-[20rem] max-w-full flex-col">
<Divider text="Billing" textAlign="left" />
<Divider text="or" textAlign="center" />
<Divider text="Optional" textAlign="right" />
</div>
);
}API reference
| Name | Description | Default |
|---|---|---|
children | Children are unsupported. Use `text` for the optional label. | — |
emphasis | 'base''strong''subtle' | 'base' |
lineStyle | Controls whether the divider line is solid or dashed. 'solid''dashed' | — |
text | Optional label rendered inside the divider line. string | — |
textAlign | Horizontal alignment of the label text. 'center''left''right' | 'center' |
weight | 'bold''thin''default' | 'default' |
<div> is passed through to it. See MDN: <div>.Accessibility
- Renders
role="separator". Screen readers may skip it and its text, so never put information only in the divider label. - Decorative lines between visually grouped content need nothing more.
import { Divider } from '@/components/ui/wideset/divider/Divider';
<div className="w-[20rem] max-w-full">
<Divider text="or" />
</div>