VisuallyHidden
Content exposed to assistive technology but not painted.
Use for
- an accessible name for an icon-only button
- a screen reader announcement, such as a live status message
- text only screen readers should read
Practices
| Guidance | Practice |
|---|---|
| Do | Pass render={<div role='status' aria-live='polite' />} for an announcement. |
| Do | Pass render where a span is not valid in context. |
API reference
VisuallyHidden
Renders a span, or the render element, and forwards its ref.
Slot: cl-visually-hidden
Examples
An icon-only button
<Button>
<Icon glyph={Trash} />
<VisuallyHidden>Delete</VisuallyHidden>
</Button>A live message
<VisuallyHidden render={<div role='status' aria-live='polite' />}>{feedback}</VisuallyHidden>