How to build an accessible Separator in React

role="separator" when meaningful so screen readers announce the division; setting decorative hides it from the accessibility tree when it is purely visual

When to use a Separator

When not to use it

Accessibility

Role separator, verified at WCAG 2.2-AA.

Common mistakes

Avoid: Multiple separators stacked to create whitespace

Prefer: Use spacing tokens for gaps; one separator for a real break

Separators imply a content division; using them for spacing misleads assistive tech

Example

<Separator />

See the full Separator reference →