Skip to content
Utilities & Providers

VisuallyHidden

server22.5 kB

Text only a screen reader gets. Being invisible is the whole point.

@stellaria/nebula-webVisuallyHiddenProps

Preview

It renders its children with the clip pattern: off the visual page, still in the accessibility tree. A preview would show nothing, which is exactly what it does.

What it is for

Two cases, and both are about a name.

An icon-only button has no accessible name, because the glyph is decorative. Either you give it an aria-label or you put the label inside a VisuallyHidden — the second wins when the text is long, carries markup, or has to be translated like every other string in the app.

A live region announces a change nobody should read twice: "3 results", "saved". The screen reader says it; the page already shows the same change some other way.

What it is not

It is not display: none and it is not visibility: hidden — those take the node out of the accessibility tree too, which defeats the purpose. It is also not a way to hide content you would rather not show: if it is meant for nobody, delete it.

Props

4
PropTypeDefault

children

ReactNode

—

className

Composes with the classes `Box` computes instead of replacing them.

string

—

component

The element it paints. An inline `span` by default, so the text can sit inside a sentence without splitting it; switch to `"div"` when the hidden content is block-level, since the browser silently breaks a block element nested in a paragraph.

(ElementType & C)"span"

reveal

Animates the element in when it first scrolls into view. `true` takes the catalogue entrance; an object tunes it — `preset`, `distance`, `spring`, `duration`, `once`, `amount`, `rootMargin` and `index` for a stagger. It lives here rather than on each surface so that `Card`, `Paper`, `GradientBorder`, `Section` and anything else built on `Box` inherit one implementation. Without it `Box` stays a server component; with it the root swaps for a client shell and the children keep rendering on the server. The entrance is a CSS transition, not a JavaScript animation: it is the only motion in the catalogue that fires WHILE the user scrolls, and the compositor should own it.

boolean | UseRevealOptions

—

Also accepts

On top of its own props, this component forwards these groups.

Style props · 128