Divider
A thin line that separates content, horizontal or vertical, with optional insets or a label.
import { Divider, LabeledDivider } from '@windmorph/react';Props
Divider 6 props
A full-width horizontal line, or a vertical line the full height of a flex row.
Leave 16px at the start, or at both ends.
M3 dividers are decorative, so by default the line is hidden from assistive tech (
role="none"). Setdecorative={false}where the line marks a real break between groups of content, to expose it as aseparator.Ref to the root element.
Also accepts the root element's HTML attributes (id, data-*, event handlers).
LabeledDivider 7 props
The supporting text below the line, e.g. a section's name.
Leave 16px at the start, or at both ends, of the line and the text.
The line is hidden from assistive tech, not the text;
decorative={false}exposes it as aseparator.Ref to the root element.
Classes for each part, by slot.
classNames.rootis merged withclassName.Inline styles for the root element.
Classes for the root element, merged with the component's own (yours win).
Also accepts the root element's HTML attributes (id, data-*, event handlers).
Tokens
M3's component tokens as CSS variables. Each is unset until you set it, on :root, a theme or any ancestor, and falls back to the default shown. The root carries data-variant (and data-size where it has sizes), which picks the variables that apply. See Component tokens in the Customisation guide.
| Variable | Default | Paints | Compose |
|---|---|---|---|
--md-comp-divider-color | var(--md-sys-color-outline-variant) | The line. | DividerTokens.Color |
Spec status
Built to the M3 Expressive divider spec. Each item of its variants and configurations links to a live example; where the M3 Expressive column of the spec differs from the original M3 one, it wins.
| Item | Status | Details |
|---|---|---|
| Full-width divider | Built | Configuration · Basic, List |
| Inset divider | Built | Configuration · Basic, List |
| Middle-inset divider | Built | Configuration · Basic |
| Vertical divider | Built | Configuration · Basic |
| Divider with supporting text | Built | Configuration · Basic |
| Grouping list items | Built | Use case · List |
Bundle size
Gzipped, as published: the component and the library code it imports. React, React Aria, Motion and the other dependencies aren't counted, and your bundler's minifier makes it smaller still. CI fails a change that grows it past its budget.
Divider,LabeledDivider: 6.3 kB
Differences from Compose
- 1px of
outline-variant(DividerTokens), drawn as a background clipped to the content box, so insets are padding and the root keeps no margins. - The
insetvalues (16px at the start or both ends) come from m3.material.io; Compose leaves insets to padding. - It is a
divrather than anhr, since anhrcan't take a vertical orientation. - It is decorative by default, hidden from assistive tech (M3: “Dividers are decorative elements”);
decorative={false}exposes it as aseparatorwhere the line marks a real break.