Skip to main content

Separator

Content separator. A simple <hr> by default, with an ornamental image variant available when an image is provided. Separators carry size and alignment values so they can serve as both plain rules and decorative section breaks (waves, ornaments, brand marks) without pulling in extra components.

Usage​

When to use

  • Between unrelated sections of page content where a visible separator helps the reader
  • As an ornamental flourish between major sections of a long-form page

When not to use

  • Between cards in a grid - spacing and card borders already do the job
  • Between list items - use list spacing tokens instead
  • To group form fields - use a <fieldset> with <legend>

Do

  • Prefer classless <hr> for plain horizontal rules
  • Use the ornamental variant for deliberate decorative flourishes, not for every section break
  • Mark decorative images alt="" and role="presentation"

Don't

  • Don't use a divider where whitespace alone would communicate the separation
  • Don't stack multiple dividers for emphasis
  • Don't omit the size and alignment values and then compensate with custom CSS

API​

Slots​

SlotRequiredDescription
content-Optional inline markup for an ornamental separator. Consumers are responsible for accessibility attributes on the root element.

Props​

PropTypeDefaultDescription
imageobject-Optional image object with url and alt fields for an image separator.
classesarray-Additional CSS class words merged into the root element.
attributesobject-Additional HTML attributes spread on the root element.

Classes​

ClassCapabilityDefaultDescription
.smSize-Small.
.mdSizeYesMedium.
.lgSize-Large.
.leftAlignment-Anchored to the left.
.rightAlignment-Anchored to the right.
.centerAlignment-Centered.

Examples​

Sizes​

.sm, .md, .lg side by side.

Line​

The plain rule, rendered as an <hr>.

Ornament​

An SVG ornament in place of the plain rule, carrying role="separator" so it keeps the break semantics the <hr> form gets implicitly.

Image​

A raster divider, carrying the same separator role as the ornament form for the same reason.

Accessibility​

  • WCAG 2.2 AA
  • <hr> has implicit role="separator" - no extra ARIA.
  • Ornament image must be decorative: alt="" and role="presentation".
  • section - full-width band with background treatment (alternative to a divider between sections)
  • margins - spacing classes are often a better choice than a visible divider