Divider / Separator

Free

Horizontal and vertical dividers with solid/dashed/dotted/gradient/text/icon variants and start/center/end alignment.

</>sv-divider dividerseparatorlayout
import { SvDividerComponent } from '@styloviz/layout';

Demo & usage

Basic usage

Usage example — open the gallery for the full interactive demo.

An interactive demo for this component lives in the gallery.

Open live demo

More examples

Vertical & dashed

example.htmlAngular
<sv-divider orientation="vertical" />
<sv-divider variant="dashed" spacing="my-8" />

Custom size

example.htmlAngular
<sv-divider width="120px" />
<sv-divider orientation="vertical" height="24px" />

Decorative vs semantic

example.htmlAngular
<!-- A visual flourish: nothing is announced -->
<sv-divider semantics="decorative" variant="gradient" />

<!-- A section title is a HEADING, not a labelled divider -->
<h2 class="text-sm font-semibold">Billing</h2>
<sv-divider semantics="decorative" />

When to use

  • Separating content groups visually without adding semantic structure.
  • Section breaks, "OR" separators between options, list/menu groupings.
  • For grouping form fields with a heading, use the Input Group instead.

Async states

None — this component has nothing to load, so it has no loading, empty or error state to drive.

Inputs

NameTypeDefaultDescription
orientationDividerOrientation'horizontal'Layout direction: horizontal or vertical.
variantDividerVariant'solid'Line style: solid, dashed, dotted, gradient, text or icon.
alignDividerAlign'center'Label/icon alignment: start, center or end.
labelstring''Optional inline text shown on the divider.
iconstring''Name of an icon in `@styloviz/icons`, e.g. `'sparkles'`. This used to be a raw `<path d="…">` string, which put SVG geometry in every consumer's config and skipped the library's sizing, stroke and dark-mode handling. Pass a name.
colorstring''Custom line color (any CSS color).
thicknessnumber1Line thickness in pixels.
widthstring''Optional explicit width (any CSS length) — e.g. a short horizontal rule.
heightstring''Optional explicit height (any CSS length) — e.g. a fixed-height vertical rule that works without a stretched flex parent.
spacingstring''Margin classes around the divider — Tailwind utilities, not a CSS length (e.g. `my-8`, or `mx-2` when vertical). Replaces the default `my-4` / `mx-4`, so `''` keeps the default and `my-0` removes it.
labelClassstring''Extra CSS classes applied to the label.
semanticsDividerSemantics'semantic'Whether this divider is a real thematic break (`semantic`) or a visual flourish (`decorative`). The default stays `semantic` because that is what every divider rendered before this input existed, and changing it would silently change what a screen reader announces on every page already using the component. ⚠️ A divider — semantic or not — is NOT a heading. A labelled rule that visually introduces a section ("Billing") gives assistive technology no heading to navigate by; use a real `<h2>`–`<h6>` for that and, if you want the line too, a `decorative` divider beside it. - `semantic` → `role="separator"` + `aria-orientation` (+ `aria-label` from `label`). - `decorative` → `role="none"`; with no label the whole divider is also `aria-hidden`, so nothing at all is announced.

Customization & theming

  • Solid, dashed, dotted and gradient lines.
  • Inline text or icon label.
  • Horizontal or vertical.
  • Optional explicit `width` / `height`, custom `color` and `thickness`.
  • `semantics`: `semantic` (default — a real thematic break) or `decorative` (a visual flourish, removed from the accessibility tree).
  • Variant axes (X-8): `variant`, `color`, `thickness`, `align`, `spacing`, `width` / `height` are APPEARANCE; `orientation` is LAYOUT; `semantics` is MEANING and is independent of how the rule looks. Known limits: `gradient` ignores `color` and `thickness`; a vertical divider needs a height — a stretched flex-row parent or an explicit `height` — or it collapses to 1rem.

Best practices

  • Do: Use a labelled divider ("OR") to separate alternative actions.
  • Do: Keep dividers subtle — they should organize, not dominate.
  • Tip: Match `spacing` (margin utility classes such as `my-8`, replacing the default `my-4`) to the surrounding rhythm so sections breathe consistently.
  • Don't: Don't use a labelled divider as a section title ("Billing", "Advanced settings"). It gives assistive technology no heading to jump to. Use a real `<h2>`–`<h6>` (or a `<fieldset>` + `<legend>` for form groups), and add a `semantics="decorative"` divider beside it if you want the line.
  • Do: Mark purely visual rules — between cards, inside a hero, under a logo — `semantics="decorative"`, so a screen reader is not told "separator" between every flourish. Keep `semantic` for genuine topic changes.
  • Tip: Layout (X-9): the host is `display: block; width: 100%` when horizontal and `inline-flex; align-self: stretch` when vertical — so a vertical divider takes its height from a flex row parent. Nothing is measured, portalled or scrolled.
  • Tip: Platform limits (X-11): under Windows forced colours the solid, dashed and dotted variants are borders and repaint in the system colour; `gradient` is a background gradient, which forced colours drops, so under `forced-colors: active` it falls back to a 1px `CanvasText` border in the same orientation — the rule stays visible in every variant. Browsers omit backgrounds when printing by default, so a `gradient` rule may not print.

Accessibility

  • `semantics="semantic"` (the default, and what every divider rendered before the input existed) exposes `role="separator"` with `aria-orientation`, named by `label`.
  • `semantics="decorative"` renders `role="none"`; an unlabelled decorative divider is also `aria-hidden`, so nothing is announced. A decorative divider with a `label` keeps the text readable in reading order ("OR" still means something) but announces no separator.
  • A divider is not a heading. Screen-reader users navigate sections by headings, and a labelled rule gives them none — see the "don't" below.

Feedback on Divider / Separator

Spotted a gap in this page, or something that didn't work as described? Comments are GitHub Discussions in the public styloviz/community repo, so posting needs a GitHub account.

Loads giscus.app and GitHub — nothing is fetched until you click.