Installation
npx logic2b@next add hover-cardUsage
import {
HoverCard,
HoverCardContent,
HoverCardTrigger,
} from "@/components/ui/hover-card"
<HoverCard>
<HoverCardTrigger>@logic2b</HoverCardTrigger>
<HoverCardContent>
Copy-paste components for building beautiful interfaces, fast.
</HoverCardContent>
</HoverCard>
Examples
Profile
Custom Delay & Alignment
Accessibility
- Built on Radix Hover Card:
it opens on pointer hover and on keyboard focus of the trigger, so it is
reachable with the
Tabkey. - It is a supplementary preview for sighted users — it does not trap focus and is not announced as a dialog, so never place essential content or actions only inside the card.
Escapedismisses an open card.
Live playground
Edit the component props and inspect the exact JSX before copying it. The preview loads only when this section enters the viewport.
Generated JSX
<HoverCard
openDelay={100}
closeDelay={100}
>
<HoverCardTrigger
href="#logic2b"
className="font-medium underline underline-offset-4"
>@logic2b</HoverCardTrigger>
<HoverCardContent>Composable UI infrastructure for people and coding agents.</HoverCardContent>
</HoverCard>API reference
Generated from the public TypeScript exports in src/ui/hover-card.tsx.
HoverCard
ComponentProps: React.ComponentProps<typeof HoverCardPrimitive.Root>HoverCardTrigger
ComponentProps: React.ComponentProps<typeof HoverCardPrimitive.Trigger>HoverCardContent
ComponentProps: React.ComponentProps<typeof HoverCardPrimitive.Content>| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
align | "center" | "end" | "start" | No | "center" | — |
sideOffset | number | No | 4 | — |
Accessibility contract
Machine-readable behavior and consumer responsibilities for hover-card.
- Support
- Primitive-managed
- Pattern
- hover preview
- Radix Hover Card
| Keys | Behavior |
|---|---|
| Tab | Focusing the trigger reveals the preview. |
| Escape | Close the open surface and restore focus. |
Built-in semantics
- The preview opens for focus as well as pointer hover.
Consumer responsibilities
- Keep the linked destination usable without the preview; do not put required actions only inside it.