Example#
Usage#
Use visually hidden text for words a screen reader needs and sighted readers get from context: the end of a link's name, a table's caption, a label beside an icon. It uses the standard clip pattern, so the text stays in the accessibility tree.
focusableshows the text when it takes focus, for skip links and similar.- Not for hiding content from everyone. Use
hiddenor conditional rendering for that.
Anatomy#
- Visible text: what everyone reads, such as "Pricing".
- Hidden text: clipped to one pixel and read by screen readers, such as " for websites".
The hidden part takes no space, so there is nothing to draw.
Volume#
It prints nothing visible, so it is the same at every volume.
Content#
- Start hidden text with a space when it continues a visible word.
- Keep it short: it completes a name, it does not explain the page.
Do and don't#
Don't
Keywords hidden in a VisuallyHidden span for search engines.
Accessibility#
- Read by screen readers, never painted;
focusablelifts the clip while focused (the skip-link pattern).
| Keys | What happens |
|---|---|
| Tab | The focusable variant shows itself while focused |
The colour pairs it prints, with their contrast on both papers:
It prints no text of its own (art layer or layout only), so it has no pair to check.
Props#
| Prop | Type | Default | Description |
|---|---|---|---|
focusable | boolean | none | Shows the content while it (or something inside it) has focus. |
render | RenderProp | none |
Tokens#
System tokens (2)
Changelog#
Arrived in 0.1.0.
- The reading layer's controls, overlays, forms and visitor prefs (P2-T1 to P2-T5): every Button is the comic hit key, with IconButton, Link and Tooltip; Input, Textarea, Select, Checkbox and CheckboxGroup, Radio and RadioGroup, Switch, Slider with the ruler, RulerReadout and SegmentedControl; Dialog, Drawer, NavSheet, Tabs, Disclosure, Faq and faqJsonLd on Base UI 1.9 where the platform falls short; Field, Fieldset, Form with the site's inline validation, ErrorSummary, Callout, Honeypot, FormTimestamp and QuoteForm; PrefsScript under 1 KB, usePref and setPref with cross-tab sync, ThemeToggle and the visitor VolumeDial; VisuallyHidden.
- SegmentedControl, Tabs and CodeBlock draw LC-05's ring outside the focused key (2 px at 2 px) instead of inset; RadioGroup and CheckboxGroup keys and cards, VolumeDial stops and link Cards mark the element that draws the ring (
data-mk-focus-ring); a focusable VisuallyHidden draws the ring. Read the whole entry