Component
Shows a rich preview card when hovering over a trigger element. Useful for user profiles, link previews, or contextual info.
View component changelog| Shortcut | Description |
|---|---|
Tab | Preserves the browser's normal tab order; HoverCard does not move focus when the trigger receives or loses focus. |
Escape | Dismisses the hover card when it is open. |
| Reference | What Rad UI follows |
|---|---|
Uses dialog semantics for the floating preview content when open; label interactive or richly structured content with accessible text. |
Import all parts of the component and piece them together
The root HoverCard component.
| Prop | Type | Default |
|---|---|---|
open | boolean | -- |
defaultOpen | boolean | false |
openDelay | number | 100 |
closeDelay | number | 200 |
onOpenChange | function | -- |
handle | Handle | -- |
onOpenChangeComplete | (open: boolean) => void | -- |
actionsRef | Ref<{ close(): void }> | -- |
triggerId | string | null | -- |
defaultTriggerId | string | null | -- |
Wraps the element (usually a link) that opens the card on hover or focus.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | false |
handle | Handle | -- |
payload | unknown | -- |
delay | number | -- |
closeDelay | number | -- |
The floating card panel that appears on hover. Accepts a size prop to control padding and max-width.
| Prop | Type | Default | Description |
|---|---|---|---|
size | string | "" | Controls the padding, max-width, and font size of the card. One of: small, medium, large. |
side | "top" | "right" | "bottom" | "left" | "bottom" | Preferred side of the trigger. Flips when there isn't room. |
align | "start" | "center" | "end" | "center" | Alignment against the trigger on the cross axis. |
sideOffset | number | 10 | Distance from the trigger in px (leaves room for the arrow). |
alignOffset | number | 0 | Shift along the cross axis in px. |
className | string | "" | Additional CSS classes applied to the content element. |
anchor | Element | VirtualElement | RefObject | () => Element | -- | |
positionMethod | "absolute" | "fixed" | "fixed" | |
collisionAvoidance | { side?, align?, fallbackAxisSide? } | -- | |
sticky | boolean | false | |
disableAnchorTracking | boolean | false | |
arrowPadding | number | 0 |