Skip to content

Divider

A thin line that separates content, horizontal or vertical, with optional insets or a label.

import { Divider, LabeledDivider } from '@windmorph/react';

Props

By name or description, across the 13 props below

Divider 6 props

  • orientationtype "horizontal" | "vertical"default "horizontal"

    A full-width horizontal line, or a vertical line the full height of a flex row.

  • insettype "none" | "start" | "middle"default "none"

    Leave 16px at the start, or at both ends.

  • decorativetype booleandefault true

    M3 dividers are decorative, so by default the line is hidden from assistive tech (role="none"). Set decorative={false} where the line marks a real break between groups of content, to expose it as a separator.

  • reftype Ref<HTMLDivElement>

    Ref to the root element.

Also accepts the root element's HTML attributes (id, data-*, event handlers).

LabeledDivider 7 props

  • childrentype ReactNodeRequired

    The supporting text below the line, e.g. a section's name.

  • insettype "none" | "start" | "middle"default "none"

    Leave 16px at the start, or at both ends, of the line and the text.

  • decorativetype booleandefault true

    The line is hidden from assistive tech, not the text; decorative={false} exposes it as a separator.

  • reftype Ref<HTMLDivElement>

    Ref to the root element.

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.

Divider tokens (md-comp-divider)
VariableDefaultPaintsCompose
--md-comp-divider-colorvar(--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.

  • 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 inset values (16px at the start or both ends) come from m3.material.io; Compose leaves insets to padding.
  • It is a div rather than an hr, since an hr can't take a vertical orientation.
  • It is decorative by default, hidden from assistive tech (M3: “Dividers are decorative elements”); decorative={false} exposes it as a separator where the line marks a real break.