Skip to content

Divider

A thematic separator: a native hr when bare, and a labeled role=separator element when it wraps a centered text label.

Import

import { Divider } from "@hyzer-labs/ui"

Demo

With no children, Divider renders a native <hr>.

Round one


Round two

<Divider />

Props

NameTypeDefaultNote
childrenSnippet— (label)Optional. Absent → bare <hr>; present → the labeled form.
variant'solid' | 'dashed' | 'dotted''solid'
spacingLayoutPadding'md'Block margin: 'none' | 'sm' | 'md' | 'lg' | 'near' | 'away' — the shared layout scale; near/away tighten inside data-density-shift regions.
lineWidth'thin' | 'thick''thin'Maps 1:1 to the --hz-border-width-thin/-thick tokens.
classstringMerged after the hz-divider class.

Theme hooks

What this component promises your CSS. The reference theme styles exactly these — from @layer hz-theme, so your unlayered rules win. See Styling Components for the how.

Root class: .hz-divider

Data attributes

HookValuesStyles
data-variant'solid' | 'dashed' | 'dotted'Line style. Default solid.
data-spacing'none' | 'sm' | 'md' | 'lg' | 'near' | 'away'Block margin from the space scale. near and away are the density distances, so dividers respond to a density shift like the layout family. Default md.
data-line-width'thin' | 'thick'1:1 with --hz-border-width-thin/-thick.
data-labeledpresent on the labeled formThe labeled form is a div with rules; the plain form is a bare hr. The theme tells them apart by element (hr.hz-divider vs div.hz-divider), so match that if you restyle.

Part classes

HookValuesStyles
.hz-divider-labelchild elementThe label. Its flanking lines are ::before/::after, so they are not separately targetable.

Accessibility

The bare form is a native <hr>: implicit role="separator", horizontal, non-focusable, and needing no ARIA.

The labeled form keeps role="separator" on the wrapping <div>, so the thematic break survives the switch away from <hr>. The label text is the separator's accessible name and stays in the tree, so screen readers announce a separator followed by its label, though the exact wording varies by reader.

The flanking rules are decorative ::before/::after pseudo-elements, never part of the accessibility tree.

References: MDN: <hr> · MDN: separator role