Visually Hidden
Content hidden visually while remaining available to assistive technology.
Content hidden visually while remaining available to assistive technology.
Import
Section titled “Import”import { VisuallyHidden } from "@zentara-co/zenos-ui";Icon-only controls
Section titled “Icon-only controls”Place a concise hidden label inside an icon-only button when visible text would be redundant. The button remains the interactive element; VisuallyHidden only contributes text to its accessible name.
Supplemental context
Section titled “Supplemental context”Hidden text can clarify a visible count, symbol, or abbreviated status. Keep the primary information visible so all users receive the same result.
API gateway
status:Healthy
Referenced labels
Section titled “Referenced labels”Use an id with aria-labelledby when a control needs a persistent accessible name but the surrounding visual design cannot show one. A placeholder is not a label.
The visible placeholder is a hint; the hidden text supplies the persistent accessible name.
Live status
Section titled “Live status”VisuallyHidden can carry a concise live-region announcement when the same outcome is also visible. Avoid announcing every intermediate update or duplicating text that another live region already reports.
Visible results: 0
No results addedWhen not to use it
Section titled “When not to use it”Do not hide essential instructions, error recovery, or content useful to sighted users. VisuallyHidden always renders a clipped span; it is not suitable for skip links or any focusable control that must become visible on focus. Style the focusable element itself with a visually-hidden-until-focused pattern instead.
API
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | Content exposed to assistive technology. |
id | string | — | Allows another element to reference the hidden text as a label or description. |
aria-live | off | polite | assertive | — | Optionally announces changing hidden status text. |
native props | React.ComponentPropsWithoutRef<'span'> | — | Forwards native attributes, events, aria-*, data-*, className, style, and ref. |
Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props,
including className, style, aria-*, and data-*.
Accessibility
Section titled “Accessibility”The content remains in the accessibility tree and normal DOM while occupying one clipped pixel visually. Test its result through the final accessible name or description rather than checking only that hidden text exists. Avoid repeating visible labels verbatim, and keep hidden copy synchronized when visible state changes.