FeedbackAvailable
Hover Card
A supplementary preview attached to a semantic link.
Installation
Add the component and its dependencies from the registry running on your computer.
terminal
npx shadcn@latest add https://brutallab.facilito.dev/r/hover-card.jsonUsage
Import the component into your project and keep the source code under your control.
tsx
'use client';
import Link from 'next/link';
import {
HoverCard,
HoverCardTrigger,
HoverCardContent,
} from '@/components/ui/hover-card';
export default function Demo() {
return (
<HoverCard>
<HoverCardTrigger
render={
<Link
href="/en/docs/components/card"
className="bl-type-label underline underline-offset-4"
/>
}
>
About Card
</HoverCardTrigger>
<HoverCardContent>
<p className="bl-type-card-title">Card</p>
<p className="mt-2 bl-type-small">
A composable surface for related content. Follow the link for full
documentation.
</p>
</HoverCardContent>
</HoverCard>
);
}
States & interaction
Appearance, behavior and keyboard checks.
- Check closed, open, highlighted, selected and disabled states where supported.
- Dialogs and menus must open from the keyboard. Escape closes non-persistent overlays and returns focus to the trigger. Tooltips and hover cards must also appear on focus.
- Test the example with Tab and Shift+Tab. Focus must stay visible in both themes.
API Reference
BrutalLab-specific properties. Native attributes are supported as well.
| Prop | Type | Default | Description |
|---|---|---|---|
| openDelay | number | primitive default | Delay before the preview opens. |
Accessibility
Rules that should remain intact when adapting the component to a product.
Hover content must be supplementary. Keep essential information available from the actual link.
Retain keyboard focus styles and test the composition with keyboard navigation.
Use className for visual customization; preserve the primitive ARIA attributes.