VisuallyHidden

VisuallyHidden hides its children visually, while keeping content visible to screen readers.

import {VisuallyHidden} from 'react-aria';

<VisuallyHidden>I am hidden</VisuallyHidden>

API

VisuallyHidden

NameTypeDefault
childrenReactNodeDefault:

The content to visually hide.

elementTypestringJSXElementConstructor<any>Default: 'div'

The element type for the container.

isFocusablebooleanDefault:

Whether the element should become visible on focus, for example skip links.

idstringundefinedDefault:

useVisuallyHidden

For additional rendering flexibility, use the useVisuallyHidden hook . It supports the same options as the component, and returns props to spread onto the element that should be hidden.

useVisuallyHidden(props: ):

Example

See useRadioGroup and useCheckbox for examples of using VisuallyHidden to hide native form elements visually.