Components
VisuallyHidden
Content for assistive technology that is hidden visually.
Server-compatible (no "use client")
import.tsx
visually-hidden-icon.tsx
Edit on GitHubPurpose
VisuallyHidden hides content visually while keeping it available to screen readers — extra
context for icons, counts or abbreviated text.
Import
import { VisuallyHidden } from "@neshel-ui/components";Usage
Preview: visually-hidden-icon
import { Button, VisuallyHidden } from "@neshel-ui/components";
import { Inline } from "@neshel-ui/layout";
import { Bell } from "lucide-react";
export default function VisuallyHiddenIcon() {
return (
<Inline space="3" align="center">
<Button variant="outline">
<Bell aria-hidden="true" />
<VisuallyHidden>Notifications</VisuallyHidden>
<span aria-hidden="true">3</span>
<VisuallyHidden>(3 unread)</VisuallyHidden>
</Button>
</Inline>
);
}API
Accessibility
Hidden content is still read and still focusable if it contains focusable elements. Do not hide
interactive controls with it. For an icon-only button, an aria-label is usually simpler.
Common mistakes
- Using it to hide content from everyone: use
hiddenordisplay: noneinstead.