Playground

Separator

A thin rule between groups.

  • Built on radix-ui/Separator
  • Decorative by default: role=none so screen readers skip it.
  • With decorative=false it is role=separator with aria-orientation.
  • Styles in one file: separator.css

Import

import '@monoline/css';
import {Separator} from '@monoline/react';

Not installed yet? Pick a route.

Copies the source and its styles into your project.

npx monoline add separator

It needs radix-ui; install it if your project does not have it:

npm install radix-ui

Usage

import {Separator} from '@monoline/react';

<div>
  <p>Above</p>
  <Separator />
  <p>Below</p>
  <div style={{display: 'flex', alignItems: 'center', height: 24}}>
    <span>One</span>
    <Separator orientation="vertical" />
    <span>Two</span>
  </div>
</div>

Examples

Horizontal and vertical

Data Attributes

State is exposed through attributes. Style it with these selectors, not with class toggles.

AttributeStylesheet
[data-orientation="horizontal"]separator.css
[data-orientation="vertical"]separator.css

CSS classes

ClassStylesheet
.separatorseparator.css

Customization

Style it with the kit's tokens in your own CSS, loaded after @monoline/css. Prefer the attributes above over extra classes. See Theming for every token.

app.css
.separator {
  border-color: var(--accent);
}
.separator[data-orientation="horizontal"] {
  background: var(--wash);
}

Accessibility

  • Decorative by default: role=none so screen readers skip it.
  • With decorative=false it is role=separator with aria-orientation.