VisuallyHidden
Text for screen readers only: the words a sighted reader gets from layout or an icon.
Examples
Naming a state
The icon and colour show the state; the hidden text says it to screen reader users.
Light
github-mcp (connected)
Dark
github-mcp (connected)
<Text as="span" tone="success">
<Icon name="circle-check" size={14} /> github-mcp
<VisuallyHidden> (connected)</VisuallyHidden>
</Text>Telling repeated links apart
Light
Dark
<Link href={editHref}>
Edit<VisuallyHidden> {server.name}</VisuallyHidden>
</Link>Usage
import { VisuallyHidden } from '@switchboard/ui'
<VisuallyHidden> (connected)</VisuallyHidden>Props
Every component also takes mix, for css() and mixins applied after its own style.
VisuallyHidden
| Prop | Type | Default | Description |
|---|---|---|---|
| children | RemixNode | – | Text to announce. |
| mix | Mix | – | Extra css() or mixins. |
Also accepts every <span> attribute.
Accessibility
- Clipped to 1px rather than display: none, so the text stays in the accessibility tree and is read in place.
- Start the text with a space when it follows a word, or the two run together when read.
- Never put focusable elements inside; a focused element would be invisible.
Guidance
Do
- Give repeated "Edit" or "Remove" links a unique name.
- Prefer aria-label on icon-only controls; use this when the words belong in the flow of text.
Don’t
- Hide headings or instructions that sighted users also need.
- Use it to stuff keywords.