How to build an accessible VisuallyHidden in React

Applies the standard clip technique so content stays in the DOM and accessibility tree while being painted off-screen — assistive tech reads it, sighted users do not see it

When to use a VisuallyHidden

When not to use it

Accessibility

Role none, verified at WCAG 2.2-AA.

Common mistakes

Avoid: Wrapping decorative content in VisuallyHidden to "clean up" the layout

Prefer: aria-hidden on decorative elements; VisuallyHidden only for content screen readers need

VisuallyHidden keeps content in the accessibility tree — using it to hide noise pollutes screen-reader output

Example

<button type="button"><CloseIcon /><VisuallyHidden>Close dialog</VisuallyHidden></button>

See the full VisuallyHidden reference →