Skip to content

Separator

  • Dividing groups in a Menu or a Toolbar
  • Splitting sections of a page or a card

Not just to add space — use margins or gaps.

Choosing between organising content:

ComponentUse it forFor example
AccordionSections stacked on one page, of which people read one or a fewFAQ, settings groups, order details
TabsViews of the same thing at the same level, one at a timeAccount / Billing / Security
CardA self-contained group of content, shown as one unit, often in a grid or listA product tile, a project summary
TableRows of records compared across the same columnsInvoices, users, order lines
SeparatorA line that divides sections, with no content of its ownBetween menu groups or toolbar groups

Account


Billing

Docs
Blog
Changelog
import { Separator } from '@arun-dev/ui';
// The Separator draws the line; the gap around it is the layout's.
export default function SeparatorBasics() {
return (
<div style={{ display: 'grid', gap: 'var(--space-md)', inlineSize: '24rem' }}>
<div style={{ display: 'grid', gap: 'var(--space-sm)' }}>
<p style={{ margin: 0 }}>Account</p>
<Separator />
<p style={{ margin: 0 }}>Billing</p>
</div>
{/* Upright, between inline items: it takes the row's height. */}
<div style={{ display: 'flex', alignItems: 'center', gap: 'var(--space-sm)' }}>
<span>Docs</span>
<Separator orientation="vertical" />
<span>Blog</span>
<Separator orientation="vertical" />
<span>Changelog</span>
</div>
</div>
);
}

Separator is an <hr>, so assistive technology announces it as a separator. orientation="vertical" stands it upright between inline items. It takes the height of the row it sits in.

Separator props
PropTypeDefaultDescription
orientation'horizontal' | 'vertical''horizontal'Across, or upright between inline items. Sets aria-orientation and data-orientation.
classNamestringConcatenated with the component's own classes, never replacing them.
renderReactElementElement or component to render instead of the default. Props, className, event handlers and ref are merged onto it.
refRef<HTMLElement>Ref to the rendered element. Merged with any ref on the render element.
…restHTMLAttributesAnything else is spread onto the rendered element, so id, aria-*, data-* and event handlers all reach the DOM.
  • A purely decorative line takes aria-hidden.
  • In a Combobox list, use Combobox.Separator. A listbox may hold only options and groups.
  • It draws the line only. Put the space around it in the layout, with gap, so a CSS reset can’t collapse it.
  • Restyle with --separator-color and --separator-thickness.