Installation
npx shadcn@latest add @iconiq/r-hover-cardProps
HoverCard
Stateful wrapper that opens a callout on delayed hover or immediate focus, then closes it once pointer and focus both leave the hover-card region.
childrenReactNodeRequired
classNamestringopenDelaynumberDefault 80
closeDelaynumberDefault 120
Open state is internal only. This implementation does not expose a controlled open prop or state-change callback.
The root keeps the original hover and focus timing, while Radix Hover Card handles portal-based positioning and collision-aware placement.
Pending timers are cleared before every new open or close request and again during unmount cleanup.
HoverCardTrigger
Trigger surface that renders a button by default or forwards behavior into a custom child through Radix Slot.
childrenReactNodeRequired
asChildbooleanclassNamestringWhen asChild is false, the component renders a plain button with type='button', a larger default hit area, and a visible focus ring.
The trigger is also used as the positioning anchor and automatically receives aria-expanded, aria-controls, and aria-haspopup.
Standard button props such as disabled, onClick, aria-*, and data-* are forwarded to the rendered trigger element.
HoverCardContent
Animated content panel with collision-aware positioning, side and align controls, and a spring-driven scale and directional offset fade.
childrenReactNodeRequired
classNamestringside"top" | "right" | "bottom" | "left"Default "bottom"
align"start" | "center" | "end"Default "center"
sideOffsetnumberDefault 12
alignOffsetnumberDefault 0
avoidCollisionsbooleanDefault true
collisionPaddingnumber | Partial<Record<Side, number>>Default 12
Additional motion.div props such as style, role, onClick, aria-*, and data-* are forwarded, but initial, animate, exit, and transition are reserved by the component.
The panel is portaled through Radix Hover Card content, while preserving the same spring-driven scale and directional offset animation.
Focus can move from the trigger into interactive content without immediately closing the card.
By default the content is centered below the trigger with a fixed w-72 width, no drop shadow, and a 12px hover bridge across the trigger-to-panel gap.
Registry bundle
Install the exact registry entry shown on the right when you want the component file and its declared runtime dependencies together.
Dependencies: @radix-ui/react-hover-card, @radix-ui/react-slot, motion.
Uses the dedicated Radix Hover Card primitive instead of Radix Popover for the floating surface.
Preserves the original delayed hover reveal, instant focus open, and spring-driven content motion.
The generated registry file is /r/r-hover-card.json.