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
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | 'horizontal' | 'vertical' | 'horizontal' | Direction of the separator |
spacing | 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'md' | Perpendicular margin around the separator |
decorative | boolean | true | When true, sets role="none" — use when the separator is purely visual |
sx | StyleXStyles | — | StyleX style override |
All other HTML attributes, such as id and aria-*, go to the root element.
Accessibility
- Renders an
<hr>element withrole="none"by default (decorative). Setdecorative={false}for a semantic separator withrole="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-orientationis set automatically based on theorientationprop.
This is an RSC-safe component — it ships no JavaScript to the browser.