VisuallyHidden

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

installyarn add @react-aria/visually-hidden
version3.0.0-alpha.1
usageimport {VisuallyHidden} from '@react-aria/visually-hidden'

Introduction#


VisuallyHidden is a utility component that can be used to hide its children visually, while keeping them visible to screen readers and other assistive technology. This would typically be used when you want to take advantage of the behavior and semantics of a native element like a checkbox or radio button, but replace it with a custom styled element visually.

Props#


NameTypeDefaultDescription
childrenReactNodeThe content to visually hide
elementTypestringJSXElementConstructor<any>'div'The element type for the container
isFocusablebooleanWhether the content can be focused

Example#


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