Layout & primitives
Divider
Free1.0 KB gzippedA line that separates content, horizontally or vertically, with an optional inline label.
Accessibility: WCAG 2.2 AA · No A or AA violations in light or dark mode · No keyboard interaction of its own · Full report
Import
import { Divider } from "@vjdesigns/vjdesigns-ui";
Importing only Divider adds about 1.0 KB of minified, gzipped JavaScript to your app (React not included). The stylesheet is shared by every component and loaded once: 75.1 KB gzipped.
Examples
Horizontal
Above the line
import { Divider, Stack, Text } from "@vjdesigns/vjdesigns-ui";
export function Horizontal() {
return (
<Stack gap={4} style={{ width: "100%", maxWidth: "26rem" }}>
<Text>Above the line</Text>
<Divider />
<Divider label="or" />
<Divider variant="dashed" tone="primary" thickness="thick" />
</Stack>
);
}
With label
A labelled divider is a natural break between sign-in methods.
import { Button, Divider, Stack } from "@vjdesigns/vjdesigns-ui";
export function WithLabel() {
return (
<Stack gap={4} style={{ width: "100%", maxWidth: "20rem" }}>
<Button fullWidth variant="outline" tone="neutral">
Continue with Google
</Button>
<Divider label="or sign in with email" />
<Button fullWidth>Email me a link</Button>
</Stack>
);
}
Vertical
Docs
Pricing
Blog
import { Divider, Flex, Text } from "@vjdesigns/vjdesigns-ui";
export function Vertical() {
return (
<Flex gap={4} align="center" style={{ height: "2rem" }}>
<Text size="sm">Docs</Text>
<Divider orientation="vertical" />
<Text size="sm">Pricing</Text>
<Divider orientation="vertical" />
<Text size="sm">Blog</Text>
</Flex>
);
}
Accessibility
A divider is a separator (role="separator") by default, and its label is readable text. When the line is purely visual, decorative hides it, label and all, from assistive technology.
By continuing you agree to the terms.
import { Button, Divider, Stack, Text } from "@vjdesigns/vjdesigns-ui";
export function Accessibility() {
return (
<Stack gap={4} style={{ width: "100%", maxWidth: "22rem" }}>
<Button fullWidth>Continue with email</Button>
<Divider label="or" />
<Button variant="outline" tone="neutral" fullWidth>
Continue with a passkey
</Button>
<Divider decorative />
<Text size="sm" tone="muted">
By continuing you agree to the terms.
</Text>
</Stack>
);
}
Translated
A divider's label is your own text; translate it with the page. LocaleProvider sets lang, so it's read in Japanese.
import {
Button,
Divider,
Stack,
LocaleProvider,
} from "@vjdesigns/vjdesigns-ui";
import ja from "@vjdesigns/vjdesigns-ui/locales/ja";
export function Translated() {
return (
<LocaleProvider locale="ja" messages={ja}>
<Stack gap={4} style={{ width: "100%", maxWidth: "22rem" }}>
<Button fullWidth>メールで続ける</Button>
<Divider label="または" />
<Button variant="outline" tone="neutral" fullWidth>
パスキーで続ける
</Button>
</Stack>
</LocaleProvider>
);
}
Right to left
The first example again, inside a right-to-left LocaleProvider (Arabic). Layout, spacing and arrow icons mirror, and the components' built-in text is translated. The example's own text stays in English.
Horizontal
Above the line
import { LocaleProvider } from "@vjdesigns/vjdesigns-ui";
import ar from "@vjdesigns/vjdesigns-ui/locales/ar";
// Horizontal is the "Horizontal" example above.
<LocaleProvider locale="ar" messages={ar}>
<Horizontal />
</LocaleProvider>
Usage notes
Semantics:
- Horizontal, no label: a native
<hr>(implicitrole="separator"). - Vertical, no label:
<div role="separator" aria-orientation="vertical">. - With a label: a
<div>whose line segments are hidden and whose label is plain, readable text. Aseparator's children are presentational in ARIA, so putting the label inside one risks it not being announced; reading it as text in document order is the most reliable. decorative:aria-hidden="true", no role; hidden from assistive tech.
API reference
Divider
| Prop | Type | Default |
|---|---|---|
orientationDirection of the line. Vertical dividers stretch to the height of a flex row. | "horizontal""vertical" | — |
variantLine style. | "solid""dashed""dotted" | — |
thicknessLine thickness. | "thin""thick" | — |
toneLine color. | "strong""neutral""primary""accent""success""warning""danger""info" | — |
spacingSpace around the line on the cross axis (block margin when horizontal, inline margin when vertical), as a | Space | — |
insetShorten the line from its start, end, or both ends. | "none""start""end""both" | — |
labelInline label shown in the line (e.g. "or", "Second half"). Rendered as readable text, not inside an | ReactNode | — |
childrenLabel content, as an alternative to | ReactNode | — |
labelPositionWhere the label sits along the line. Ignored without a label. | "start""center""end" | — |
decorativePurely visual line. Hides the whole divider (including any label) from assistive technology with | boolean | — |
refRef to the root element ( | Ref<HTMLElement> | — |
Also accepts native <div> attributes, plus className, style and ref.
See what changed in each version in the Changelog.
Accessibility report
Divider targets WCAG 2.2 AA. Below: a live axe-core audit of this page's examples, Lighthouse scores for the page in both modes, the accessibility behavior built into the component, and the checks only a person can do.
axe-core audit (live)
Checking the examples above…
Lighthouse audit
Light mode
Score 10035 passed · 0 failed · 30 not applicable · 10 to check by hand
Dark mode
Score 10035 passed · 0 failed · 30 not applicable · 10 to check by hand
Lighthouse 13.5.0 audits the whole docs page (header and sidebar included), not just the examples, in English. Last run 11/27/2026. Some failed audits carry no weight in the score, so a page can score 100 and still list one.
Built-in behavior
Keyboard
Not focusable, so there's no keyboard interaction of its own.
Roles and states
| Element | Role | States and properties |
|---|---|---|
<hr> (horizontal) | separator | — |
| Vertical divider | separator | aria-orientation="vertical" |
decorative | none | aria-hidden="true" |
Manual checks
Automated tools find roughly a third of accessibility issues. Test these in your app, with your content.
| Check | What to test | WCAG 2.2 |
|---|---|---|
| Keyboard | Every action works with Tab, Shift+Tab, Enter, Space and the arrow keys, and focus never gets stuck. | 2.1.1 (A), 2.1.2 (A) |
| Focus | Focus moves in a logical order, is always visible, and isn't hidden behind sticky headers. | 2.4.3 (A), 2.4.7 (AA), 2.4.11 (AA), 2.4.13 (AAA) |
| Screen readers | Names, roles and states are announced correctly, and status changes are announced without moving focus. | 1.3.1 (A), 4.1.2 (A), 4.1.3 (AA) |
| Color | Meaning never depends on color alone; your own colors meet contrast in both modes. | 1.4.1 (A), 1.4.3 (AA), 1.4.11 (AA), 1.4.6 (AAA) |
| Zoom and reflow | At 200% text size and at 320px wide (400% zoom), nothing is cut off and no sideways scrolling is needed. | 1.4.4 (AA), 1.4.10 (AA), 1.4.12 (AA) |
| Pointer targets | Click and tap targets are at least 24×24px (44×44px for AAA), or spaced so they don't overlap. | 2.5.8 (AA), 2.5.5 (AAA) |
| Motion | Animations respect the reduced-motion setting. | 2.3.3 (AAA) |