Castle UI exports 2 components for the VisuallyHidden.
- VisuallyHidden: Visually hidden span component used to hide elements on screen.
- VisuallyHiddenInput: Visually hidden input component used for designing custom input components using the html input as a proxy
Usage
Import
import { VisuallyHidden, VisuallyHiddenInput } from '@passfort/castle'content_copyCopy
Example
It is used to visually hide an element but to make it accessible for screen-readers. It renders html <span>
as a proxy.
content_copyCopy
live example
Visually hidden input
It renders html <input>
as a proxy.
content_copyCopy
live example
Accessibility
VisuallyHidden has all the styles necessary to hide it from visual clients, but keep it for screen readers.