Separator

A visual divider between sections of content.

Import

import { Separator } from '@matix/components/separator';

Usage

Content above


Content below

Orientation

Separators can be horizontal (default) or vertical.

import * as stylex from '@stylexjs/stylex';

const layout = stylex.create({
  row: { display: 'flex', gap: 16 },
  inline: { display: 'flex', alignItems: 'center', gap: 8 },
  divider: { height: '1em' },
});

<div {...stylex.props(layout.row)}>
  <div>
    <p>First</p>
    <Separator orientation="horizontal" />
    <p>Second</p>
  </div>

  <div {...stylex.props(layout.inline)}>
    <span>Left</span>
    <Separator orientation="vertical" sx={layout.divider} />
    <span>Right</span>
  </div>
</div>;

Custom Styles

import * as stylex from '@stylexjs/stylex';

const custom = stylex.create({
  dashed: { borderStyle: 'dashed' },
});

<Separator sx={custom.dashed} />;

API Reference

PropTypeDefaultDescription
orientation'horizontal' | 'vertical''horizontal'Direction of the separator
spacing'none' | 'sm' | 'md' | 'lg' | 'xl''md'Perpendicular margin around the separator
decorativebooleantrueWhen true, sets role="none" — use when the separator is purely visual
sxStyleXStyles—StyleX style override

All other HTML attributes, such as id and aria-*, go to the root element.

Accessibility

  • Renders an <hr> element with role="none" by default (decorative). Set decorative={false} for a semantic separator with role="separator".
  • Decorative separators use a subtler border color; semantic ones use the standard border token so the line reads slightly stronger for section boundaries.
  • When decorative={false}, aria-orientation is set automatically based on the orientation prop.

This is an RSC-safe component — it ships no JavaScript to the browser.