Divider
Visually or semantically separates content.
Installation
npx vayu-ui init #one time onlynpx vayu-ui add dividernpx vayu-ui add -t divider #with test case needsUsage
Divider Example
Blog
Docs
Source
OR
Dashed
Dotted
Solid Brand
Success
Warning
Destructive
Info
Thin
Normal
Thick
Bold
<Divider />
<div className="flex items-center h-5 gap-2">
<span>Blog</span>
<Divider orientation="vertical" />
<span>Docs</span>
<Divider orientation="vertical" />
<span>Source</span>
</div>
<Divider>
<Divider.Line />
<Divider.Label>OR</Divider.Label>
<Divider.Line />
</Divider>
<Divider>
<Divider.Line variant="dashed" color="brand" />
<Divider.Label color="brand">Brand</Divider.Label>
<Divider.Line variant="dashed" color="brand" />
</Divider>
<Divider>
<Divider.Line size="thick" />
<Divider.Label>Thick</Divider.Label>
<Divider.Line size="thick" />
</Divider>
<Divider>
<Divider.Line variant="dotted" color="destructive" />
<Divider.Label color="destructive">Error</Divider.Label>
<Divider.Line variant="dotted" color="destructive" />
</Divider>
<Divider spacing="lg" />Anatomy
<Divider>
<Divider.Line />
<Divider.Label>Label</Divider.Label>
<Divider.Line />
</Divider>- Divider — Root container. Renders a default line when no children are provided.
- Divider.Line — A single line segment with variant, color, and size controls.
- Divider.Label — Text rendered between divider lines.
Accessibility
- Keyboard support: The divider is a non-interactive element and does not require keyboard handling.
- ARIA attributes: By default, renders with
role="separator"andaria-orientationmatching theorientationprop. Whendecorative={true}, the divider is hidden from assistive technology viaaria-hidden="true". When children (labels) are present, no role is applied since the content is readable. - Focus behavior: The divider is not focusable and does not participate in tab order.
Screen reader behavior
- Default (no children): Announced as a separator. Screen readers may say "horizontal separator" or "vertical separator" depending on orientation.
- With label (children): No separator role is applied. The label text is read naturally as part of the page content flow.
- Decorative: Completely hidden from assistive technology. Screen readers skip it entirely.
Component Folder Structure
Divider/
├── Divider.tsx # Root layout + compound assembly
├── DividerLine.tsx # Line subcomponent with variant/color/size
├── DividerLabel.tsx # Label subcomponent
├── types.ts # Types, interfaces, design token maps
├── index.ts # Public API exports
└── README.md # Component documentationProps
Divider
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | 'horizontal' | 'vertical' | 'horizontal' | Layout direction of the divider. |
spacing | 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'md' | Spacing margin around the divider. |
decorative | boolean | false | When true, hides the divider from assistive technology. |
children | ReactNode | — | Content to render inside the divider. If omitted, renders a default line. |
Divider.Line
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'solid' | 'dashed' | 'dotted' | 'solid' | Visual style of the line. |
color | 'default' | 'brand' | 'success' | 'warning' | 'destructive' | 'info' | 'default' | Theme color of the line. |
size | 'thin' | 'normal' | 'thick' | 'bold' | 'normal' | Thickness preset (1, 2, 3, 4px). |
thickness | number | — | Custom pixel thickness, overrides size. |
opacity | number | 1 | Opacity of the line (0–1). |
orientation | 'horizontal' | 'vertical' | 'horizontal' | Orientation of this line segment. |
Divider.Label
| Prop | Type | Default | Description |
|---|---|---|---|
color | 'default' | 'brand' | 'success' | 'warning' | 'destructive' | 'info' | 'default' | Text color of the label. |
children | ReactNode | — | Label content. |