# Visually hidden

Text that screen readers read but the page does not show.

- Family: display
- Import: `import { VisuallyHidden } from "@senvenli/react/display";`
- Page: https://design.senvenli.com/docs/components/visually-hidden
- JSON: https://design.senvenli.com/docs/components/visually-hidden.json

## Example: Context for a screen reader

The glyph says it to the eye; the hidden words say it to a screen reader.

```tsx
import { Text, VisuallyHidden } from "@senvenli/react/display";

export default function Example() {
  return (
    <Text>
      <span aria-hidden>★★★★☆</span>
      <VisuallyHidden>Rated 4 out of 5</VisuallyHidden>
    </Text>
  );
}
```

## Guidelines

### When to use it

- A heading that names a region the layout already makes obvious.
- Context an icon or a glyph gives sighted users.

### Use something else when

- [skip-link](https://design.senvenli.com/docs/components/skip-link.md): A link to jump past the navigation.

### Do and avoid

- Never hide something a sighted user needs to read.

## Accessibility

Built in:

- Hidden with the sr-only technique, so it stays in the accessibility tree.
- `isFocusable`: shown while it has keyboard focus.

You provide:

- The words to read.

## API reference

### VisuallyHidden

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| children | `React.ReactNode` |  | yes |  |
| elementType | `"div" \| "span" \| "label" \| "h2" \| "h3"` | `"span"` | no | `span` (default) inside a line, `div` for a block (a hidden heading that names a region). |
| isFocusable | `boolean` |  | no | Shown while it, or something in it, has keyboard focus: a skip link, a hidden "edit" action. |
| id | `string` |  | no |  |

## Related

- [skip-link](https://design.senvenli.com/docs/components/skip-link.md)
- [icon](https://design.senvenli.com/docs/components/icon.md)
