Divider
A rule between two blocks of content. The plain form is a native <hr> whose line fades out at both ends; the labelled form puts a word in the middle — the “or” between two sign-in buttons, the name of the next group in a long form. A brand variant and a vertical rule for toolbars complete the family.
Couldn't load the demo. Open alone — Plain, labelled, brand and vertical
<div class="iv-stack iv-u-gap-2 iv-u-max-w-measure">
<p class="iv-u-m-0">A plain rule between two blocks fades in and out at both ends.</p>
<hr class="iv-divider">
<p class="iv-u-m-0">A labelled rule separates two ways of doing the same thing.</p>
<div class="iv-stack iv-u-gap-3">
<button class="iv-button iv-button--secondary iv-u-w-full" type="button">Continue with a passkey</button>
<div class="iv-divider" role="separator" aria-label="or"><span class="iv-divider__label" aria-hidden="true">or</span></div>
<button class="iv-button iv-button--primary iv-u-w-full" type="button">Continue with email</button>
</div>
<div class="iv-divider iv-divider--start iv-divider--brand" role="separator" aria-label="Release notes"><span class="iv-divider__label" aria-hidden="true">Release notes</span></div>
<p class="iv-u-m-0">The brand variant draws the line with the primary; <code>--start</code> and <code>--end</code> move the label to one side.</p>
<div class="iv-cluster iv-u-items-stretch iv-u-gap-0" style="block-size: 2.5rem">
<button class="iv-button iv-button--ghost iv-button--sm" type="button">Bold</button>
<button class="iv-button iv-button--ghost iv-button--sm" type="button">Italic</button>
<hr class="iv-divider iv-divider--vertical" aria-orientation="vertical">
<button class="iv-button iv-button--ghost iv-button--sm" type="button">Link</button>
</div>
<p class="iv-u-m-0 iv-u-text-sm iv-u-text-muted">Sample buttons: none of them does anything.</p>
</div>When to use it
Reach for a divider when two neighbours need a visible pause but not a new section: two ways of doing the same thing, a group of settings that changes topic, a toolbar whose buttons fall into families. If the content after the rule deserves a heading, give it a heading instead; a heading is navigable, a rule is not.
Spacing is part of the component: --iv-divider-space (the sixth step of the space scale by default) sits above and below the line, so you do not need margin utilities around it. Inside an iv-stack with its own gap, set the local to 0 and let the stack space it.
Variants
- Plain —
<hr class="iv-divider">. One continuous line that fades at the ends. - Labelled —
<div class="iv-divider" role="separator" aria-label="or">withiv-divider__labelinside. The two halves of the line stop short of the label. - Start and end —
iv-divider--startandiv-divider--endmove the label to one side; the line runs on from it, like a section marker in a changelog. - Brand —
iv-divider--branddraws the line in the primary at 60 %, which follows a one-colour theme. - Vertical —
<hr class="iv-divider iv-divider--vertical" aria-orientation="vertical">stands between inline items of a cluster or a toolbar and stretches to their height.
Accessibility
A native <hr> already has the separator role. A labelled divider is a <div>, so it declares role="separator" and carries its name in aria-label; the visible label is marked aria-hidden="true", which keeps screen readers from reading “or” twice. Purely decorative rules inside a card that already has headings can be aria-hidden too. The line keeps a solid colour in forced-colours mode, where gradients are dropped.
Customising
.checkout {
--iv-divider-color: var(--iv-color-border-strong);
--iv-divider-space: var(--iv-space-4);
}Locals: --iv-divider-color (the line, --iv-color-border by default) and --iv-divider-space (the room around it). The label uses the muted text colour and the small type step, so it never competes with the content on either side.
Common mistakes
- Using a divider instead of a heading to start a new topic.
- Leaving the visible label exposed as well as the
aria-label: the word is announced twice. - A vertical rule in a block that has no height: it stretches to the tallest sibling, so it needs a flex row such as
iv-cluster. - Stacking margin utilities on top of
--iv-divider-space, which doubles the gap.
Class index
Every class of the family. The full list per stylesheet lives in the reference.
| Class | What it does |
|---|---|
iv-divider | A horizontal rule with room above and below. |
iv-divider__label | The word in the middle of a labelled divider (aria-hidden). |
iv-divider--start | Label at the inline start, line running on after it. |
iv-divider--end | Label at the inline end. |
iv-divider--brand | Line drawn with the primary colour. |
iv-divider--vertical | Vertical rule between inline items. |