[ Data Display ]

Divider

A line that separates content: horizontal or vertical, solid, dashed, dotted, double or gradient, in any thickness, length and color, with an optional label you can place at the start, center or end.

12 examplesDark modeAccessible

Import#

import { Divider } from 'reusify-ui';

When to use#

  • Separating groups inside a card, menu, form or settings page.
  • Labelled dividers such as "OR" between sign-in methods, or a section title in a long list.
  • Vertical dividers between toolbar items or inline links.
  • Prefer spacing alone when the groups are already clearly separate; too many lines add noise.

Examples#

[ Basics ]

Horizontal & labelled#

Sign in with your email

<p>Sign in with your email</p>
<Divider label="OR" />
<Button variant="secondary" fullWidth>Continue with GitHub</Button>

Vertical#

Inside a flex row, a vertical divider stretches to the row height. length sets a fixed height instead, centered in the row.

Docs
Components
GitHub
npm
<div style={{ display: 'flex', alignItems: 'center' }}>
  <span>Docs</span>
  <Divider orientation="vertical" />
  <span>Components</span>
  <Divider orientation="vertical" variant="dashed" />
  <span>GitHub</span>
  <Divider orientation="vertical" length={12} color="primary" size="md" />
  <span>npm</span>
</div>

[ Styles ]

Variants#

gradient fades out at both ends, which works well between page sections. double needs at least 3px, so it widens itself.

solid
dashed
dotted
double
gradient
<Divider />                    {/* solid */}
<Divider variant="dashed" />
<Divider variant="dotted" />
<Divider variant="double" />
<Divider variant="gradient" />

Thickness#

size is sm (1px, default), md (2px), lg (4px), a number of pixels or any CSS length.

sm
md
lg
6
<Divider size="sm" />
<Divider size="md" />
<Divider size="lg" />
<Divider size={6} color="primary" />

Colors#

color takes a semantic name (follows your theme) or any CSS color. Without it the divider uses --ru-border.





<Divider color="primary" size="md" />
<Divider color="success" size="md" variant="dashed" />
<Divider color="danger" size="md" variant="dotted" />
<Divider color="#f97316" size="md" variant="gradient" />
<Divider color="oklch(0.7 0.15 200)" size="md" label="Custom" />

[ Layout & labels ]

Length & alignment#

length shortens the line (any CSS length or pixels); align places it at the start, center or end.





<Divider length="40%" align="start" color="primary" size="md" />
<Divider length="40%" align="center" color="primary" size="md" />
<Divider length="40%" align="end" color="primary" size="md" />
<Divider length={64} size="lg" color="primary" />

Spacing#

spacing is the margin on both sides of the line: none, sm, md (default), lg, xl, a number or a CSS length.

Above


Tight


Roomy

<p>Above</p>
<Divider spacing="none" />
<p>Tight</p>
<Divider spacing="xl" />
<p>Roomy</p>

Label position & content#

labelPosition moves the label to the start, center or end. The label can be any element: text, an icon or a Badge.

<Divider label="Today" labelPosition="start" />
<Divider label={<><FiStar /> Featured</>} />
<Divider label={<Badge size="sm" color="success">New</Badge>} labelPosition="end" />

[ Playground ]

Divider playground#

Every control at once. The code updates as you change them.

<Divider
  variant="gradient"
  size="md"
  color="#7c6fff"
  label="Section"
/>
// Change the controls in the preview to generate the code.

Light & dark#

The default color is the theme border token, so dividers stay subtle in both themes. Semantic colors adapt too.

Account


Billing


Danger zone

Account


Billing


Danger zone

<div className="light">…</div>
<div className="dark">…</div>

[ Patterns ]

Section titles in a list#

Deploy succeeded

Priya commented on #42

Invoice paid

New sign-up: Aarav

<Divider label="Today" labelPosition="start" spacing="sm" />
<Message … />
<Divider label="Yesterday" labelPosition="start" spacing="sm" />
<Message … />

Toolbar groups#


<Button iconOnly variant="ghost" aria-label="Bold"><FiBold /></Button>
<Button iconOnly variant="ghost" aria-label="Italic"><FiItalic /></Button>
<Divider orientation="vertical" length={20} spacing="sm" />
<Button iconOnly variant="ghost" aria-label="Link"><FiLink /></Button>

Used in designs#

Divider in real layouts: these 9 designs use it. Open one to try it and copy the code.

API reference#

<Divider />

Renders an <hr> (or a <div role="separator"> when labelled) and accepts its attributes.

orientation'horizontal'
'horizontal' | 'vertical'

Direction of the line.

variant'solid'
'solid' | 'dashed' | 'dotted' | 'double' | 'gradient'

Line style. gradient fades at both ends.

size'sm'
'sm' | 'md' | 'lg' | number | CSS length

Thickness: 1px, 2px, 4px or custom.

color--ru-border
'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | CSS color

Line color.

length'100%' / 'auto'
number | CSS length

Width (horizontal) or height (vertical).

align'center'
'start' | 'center' | 'end'

Position of a shortened horizontal line.

spacing'md'
'none' | 'sm' | 'md' | 'lg' | 'xl' | number | CSS length

Margin around the line (0.75rem for vertical by default).

label-
ReactNode

Content in the line (horizontal only).

labelPosition'center'
'start' | 'center' | 'end'

Where the label sits.

Accessibility#

  • Renders <hr> (or role="separator" when labelled) with aria-orientation, so assistive tech understands it as a separator.
  • Dividers are decorative structure; never rely on color alone to convey meaning.