VisuallyHidden
Words for screen readers only: on the page and read aloud, not seen. With focusable it shows when it takes focus, as a skip link.
import { VisuallyHidden } from '@sypnia/ui/react'
Words the eye does not need
Orders went up 12 percent this week
Skip to the table (press Tab to see me)Code
import { IconButton, VisuallyHidden } from '@sypnia/ui/react';
export default function Words() {
return (
<div className="sy-stack" style={{ '--gap': 'var(--s-3)' } as React.CSSProperties}>
<p>Orders <span aria-hidden="true">↑ 12%</span><VisuallyHidden>went up 12 percent this week</VisuallyHidden></p>
<VisuallyHidden as="a" focusable>Skip to the table (press Tab to see me)</VisuallyHidden>
<IconButton icon="trash" label="Delete the row 1042" />
</div>
);
} When to use it
Use it when
- Saying in words what a symbol or a layout says to the eye.
Do not use it when
- Hiding content from everyone: use
hidden.
For everyone
- Its text is read in its place in the page.
Props
| VisuallyHidden | Type | Default |
|---|---|---|
as | "span" | "h2" | "a" | "div" | span |
focusable | boolean | |
id | string |