Raft Design System

Components · Layout

Separator

A 1px hairline between groups of content in one region, horizontal or vertical, with an optional word in the middle of a horizontal one.

StableAlso called Divider
import { Separator } from "@botiverse/raft-ui";

A separator is a 1px line-hairline between two groups of content in the same region: two groups of settings, or two controls in a row. A horizontal separator can carry a short word in its middle that names the group after it, such as Actions. Lines between regions are not separators; they belong to the regions (Page structure).

separator/compositions/horizontal

When to use

SituationUse
Two groups of content in one regionSeparator
Two groups of controls in a row of fixed heightSeparator with orientation="vertical"
A named break before a groupSeparator with a word: Actions
Sections of a menu, a select list or a popoverThe component's own separator: DropdownMenuSeparator, SelectSeparator, PopoverSeparator
Rows of a listNothing: the rows of a list have no dividers (Lists)
A header and its content, a rail and a sidebar, two columnsThe line-seam the region draws (Color)
Sections of a large formFormSection, which draws its own hairline

Variants

VariantUse for
orientation="horizontal" (default)Stacked groups. It takes the full width
orientation="vertical"Groups side by side in a row. It takes the height of the row, so the row needs a fixed height. For a shorter line, give it its height and self-center (className="h-5 self-center"): a line shorter than its row is centred on it, never left at the top
Horizontal, with childrenA word between two lines, in text-footnote, semibold, foreground-hint

Content

  • Keep the word short, in sentence case: Actions.

Accessibility

  • Separator wraps the Base UI Separator, which gives it the separator role and its orientation.
  • The two lines around a word are hidden from assistive technology; the word is read.

Rules

  • Use only line-hairline in a separator. Don't restyle it as a seam or a strong line: each line means something (Color).
  • Never draw a separator next to a region's own edge. Two 1px lines side by side read as one 2px line (Page structure).

API

Separator

PropTypeDefault
childrenReactNode
orientationThe orientation of the separator.Orientation"horizontal"
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

Changes

  • 0.101.0 · FixedA vertical Separator given its own height can be centred ([Separator › Variants](https://raft-design.botiverse.build/components/separator/#variants)). <Separator orientation="vertical" className="h-5 self-center" /> is now centred on its row; before, it sat at the row's top.