Skip to content

Separator

A line that divides content, and — unless you opt out — tells a screen reader that it does. It runs either way: horizontal across stacked content, vertical down a row.

separator/horizontal.tsx

Billing

Visa ending 4242 · renews 1 September

Notifications

Email only · digest at 09:00

Import

import { Separator } from "@forte-ui/react";

Examples

Vertical

Set orientation="vertical" and the rule turns, along with the aria-orientation it reports.

A vertical separator is an empty box, so it has no length of its own. Inside a flex row it stretches to the tallest sibling; anywhere else — in ordinary flow, or between inline items like the metadata below — it falls back to one line's height. That floor is --forte-separator-min-length, and it is the only reason a vertical rule is ever visible outside a flex container.

separator/vertical.tsx
DraftEdited 3 minutes ago2 collaborators

In a toolbar the stretch is the point: the rule matches whatever it sits between, without anyone measuring the buttons.

separator/toolbar.tsx

Line style

variant is the whole visual API — a rule has exactly one dimension. solid reads as a structural division; dashed and dotted read as provisional ones, which is what you want for a drop zone's edge or an optional section.

separator/variants.tsx
solid
dashed
dotted

Spacing and inset

Two knobs place the rule, and they are named after the axes rather than after margin because which physical side each one touches flips with the orientation:

  • --forte-separator-spacing runs along the axis being separated — the gap between the rule and the content on either side of it.
  • --forte-separator-inset runs across it — how far the rule is pulled in from the container's edges. Negative values push it back out, which is how a rule inside a padded panel becomes full-bleed.

Both default to 0, because the common case is a flex or grid parent whose gap already does the spacing and a built-in margin would double it.

separator/custom.tsx
Overview
Members
Integrations
Danger zone

In prose

Separator renders a <div>. Where the division is a genuine thematic break in running text, swap the element for the one HTML already has:

<Separator render={<hr />} />

The styles follow. The UA gives <hr> an inset 3D border and a 0.5em auto margin; both are cleared before this component paints its own single edge, so an <hr> and a <div> separator are pixel-identical.

Accessibility

Base UI renders role="separator" with an aria-orientation matching the prop, so the division is announced rather than merely drawn.

That is right when the rule is the grouping. It is noise when the grouping is already carried by a heading, a landmark or a list and the rule only reinforces it visually — a screen reader then reads the page's decoration out loud. Pass decorative for that case:

<Separator decorative />

Theming

The line is painted with a border, never background-color. Under forced-colors a background is replaced with a system colour — for a plain box that is Canvas, the page's own backdrop — so a hairline drawn that way disappears for exactly the users who most need the grouping cue. Border colours are forced to CanvasText instead, so the rule survives with no forced-colors rule in the stylesheet at all.

Nothing here transitions. A separator has no states, so there is nothing to animate, and a colour transition would only make it lag behind the rest of the page on a theme switch.

Theming tokens for Separator
PropertyControlsDefault
--forte-separator-colorLine colourvar(--forte-color-border-muted)
--forte-separator-thicknessLine thickness1px
--forte-separator-styleLine style; variant sets thissolid
--forte-separator-spacingMargin along the axis being separated0px
--forte-separator-insetMargin across it — how far in from the edges0px
--forte-separator-min-lengthLength floor for a vertical rule with nothing to stretch against1lh

State is on data-orientation and data-variant, so a consumer can reach both from plain CSS or a Tailwind arbitrary variant (data-[orientation=vertical]:...) without wrapping the component.

API reference

Props for Separator
PropTypeDefaultDescription
classNamestringAdditional class name(s). Applied after the internal styles so consumer utilities (e.g. Tailwind) win without needing `!important`.
decorativebooleanfalseDrops `role="separator"`, leaving the line visible but absent from the accessibility tree. Use it when the grouping is already conveyed some other way — a heading, a landmark, a list — and the rule is only reinforcing it visually. Announcing a boundary that the structure already communicates makes a screen reader read the page's decoration out loud.
orientationSeparatorOrientationhorizontalWhich way the rule runs — and therefore which axis it separates. A `horizontal` rule is a line across the inline axis dividing stacked content; a `vertical` one is a line down the block axis dividing content in a row. It is also what Base UI reports as `aria-orientation`, so it is a semantic choice, not only a visual one.
variantSeparatorVariantsolidThe line style. A rule has exactly one visual dimension, so this is the whole of it: `solid` for structural divisions, `dashed` or `dotted` for softer, more provisional ones (a drop zone's edge, an optional section).