oks-ui

How to use

Divider

Divider is a horizontal or vertical rule for separating content — sections of a page, items in a list, a sidebar from its main content. It optionally carries an inline label ("OR", a date, a section name), splitting the line into two segments around it instead of just interrupting it.

import { Divider } from "oks-ui";

Horizontal and vertical

orientation defaults to horizontal. A vertical Divider needs an explicit height from its container (flex/grid context) to actually render a visible line — it doesn't invent a height on its own the way a horizontal rule fills its container's width.

<Divider />

<div className="flex h-6 items-center gap-3">
  <span>Profile</span>
  <Divider orientation="vertical" />
  <span>Settings</span>
</div>

Inset variants

variant controls how the line relates to its container's edges: fullWidth (the default) spans edge to edge; inset stops short of one end (useful in a list where the line shouldn't run under a leading icon); middle stops short of both ends.

<Divider variant="inset" />
<Divider variant="middle" />

Line style and color

lineStyle switches between solid (the default), dashed, and dotted. color takes the usual semantic palette, and thickness lets you override the line weight directly when the default doesn't match a specific design need.

<Divider lineStyle="dashed" color="primary" />
<Divider thickness={2} />

Labeled dividers

Pass children and Divider renders as two line segments with the content between them — the standard "OR" pattern between two sign-in options, a date separator in a message list, a small section label inline in a long form. labelPlacement moves the label toward the start, center (default), or end of the line.

<Divider>OR</Divider>
<Divider labelPlacement="start">Yesterday</Divider>

Accessibility

  • Renders as a semantic separator (not a plain styled <div>), so assistive technology recognizes it as a content boundary rather than an unlabeled decorative element.
  • A labeled Divider's text content is real, readable text — not an image or a background-only visual trick — so it's announced the same way any other inline text would be.

Props reference

All available props for Divider. See the full component page for an interactive playground.

Props

children

ReactNode

Default:

Optional inline label; renders the line in two segments around it.

Best practices

  • Use a vertical Divider inside a flex row with an explicit height (h-6, h-full, etc.) — without one it collapses to zero height and renders invisibly, which reads as a bug rather than a missing style.
  • Reserve variant="inset"/"middle" for list-style contexts where the line needs to visually align with adjacent icons or padding; default to fullWidth everywhere else.
  • Keep labeled-divider text very short ("OR", a date, a single section word) — it's a line label, not a heading.
  • Prefer Divider over an ad-hoc border-top/border-bottom utility class when the separator carries semantic meaning (separating real sections) rather than being purely decorative spacing.
View full API reference for Divider