Skip to contentWolf-Rayet

Visually hidden

Hides content from the screen but keeps it available to screen readers.

Install

One package and one stylesheet. The stylesheet holds the tokens every component uses.

pnpm add @wolf-rayet/react
import '@wolf-rayet/react/css/wolf-rayet.css';
import { VisuallyHidden } from '@wolf-rayet/react';

Props

A required prop is marked with an asterisk.

PropTypeDefaultDescription
children *ReactNodeNoneThe text to hide from the screen while leaving it available to a screen reader.

Accessibility

What the component does for you, and what it needs from you.

  • The text stays in the accessibility tree and the reading order. That is how it differs from display none.
  • Anything focusable inside it can still receive focus, so do not put controls in it.
  • Use it to add to what is on screen, not to give some users information that others do not get.