What is @radix-ui/react-visually-hidden?
The @radix-ui/react-visually-hidden package is designed to assist developers in creating accessible web applications by providing a component that visually hides content but keeps it accessible to screen readers. This is particularly useful for enhancing the accessibility of websites without compromising the design or user interface.
Visually hiding content
This feature allows developers to hide text or other elements visually while still making it accessible to screen readers. The provided code demonstrates how to wrap content within the VisuallyHidden component to achieve this effect.
import VisuallyHidden from '@radix-ui/react-visually-hidden';
function App() {
return (
<VisuallyHidden>
<p>This text is hidden visually but accessible to screen readers.</p>
</VisuallyHidden>
);
}