Visually Hidden

Hides its children visually, while keeping content visible to screen readers. This would typically be used to visually hide labels but keeping them accessible to screen readers, and when you want to take advantage of the behavior and semantics of a native element (like a checkbox or radio button), but replace it with a custom styled element.

Features

  • Visually hides content while preserving it for assistive technology.

Parts and their API

Usage

VisuallyHiddenExample.tsx
  1. 1
  2. 2
  3. 3
  4. 4
<Button>
<Icon name="bars-3" />
<VisuallyHidden>Open sidebar</VisuallyHidden>
</Button>

Source

visually-hidden.tsx
  1. 1
  2. 2
  3. 3
  4. 4
import { VisuallyHidden } from 'react-aria'
export { VisuallyHidden }