Hover Card
Card on hover. Free, MIT · Overlays and notifications › Popovers and tours
Rich preview for sighted pointer users; the trigger must remain useful on its own.
Installation
npx valyro-cli@latest add hover-card
npx shadcn@latest add https://valyro.xyz/r/hover-card.json
npm install valyro-ui
import 'valyro-ui/styles.css';
import { HoverCard } from 'valyro-ui';
Props
| Prop | Type | Default | |
|---|---|---|---|
trigger | ReactElement | A single focusable element, typically a link. Or HoverCard.Trigger. | |
children * | ReactNode | Card content, e.g. a profile preview; stays open while the pointer is over it. In the compound form, a HoverCard.Trigger and a HoverCard.Content instead of trigger and the content. | |
open | boolean | Controlled open; use with onOpenChange. | |
defaultOpen | boolean | false | Initial open when uncontrolled. |
onOpenChange | (open: boolean) => void | Called with the new open when it changes. | |
openDelay | number | 500 | Delay before opening on hover/focus, ms. |
closeDelay | number | 200 | Delay before closing once the pointer leaves the trigger and the card, ms. |
placement | Placement | 'bottom' | |
offset | number | ||
matchAnchorWidth | boolean | ||
closeOnOutside | boolean | ||
closeOnEscape | boolean | ||
insideRefs | RefObject<Element | null>[] | Extra elements treated as "inside" for outside-press detection. The anchor is included automatically. | |
surface | boolean | Apply the shared .ui-floating material (default true). | |
animation | 'pop' | 'fade' | 'spring' | 'none' | Enter/exit: pop (the theme's), fade, spring (springs out of the anchor's side) or none. |
Compound parts
HoverCard.Trigger (HoverCardTrigger), HoverCard.Content (HoverCardContent)
Related components
- Popover — Floating content
- Tour — Onboarding tour: element spotlight, steps, progress and resume
- Alert — Inline alerts
- Toast — Pop-up notifications
- Notification Center — Notification inbox
- Loading Overlay — Loading screen
- Dialog — Modal dialogs
- Confirm Dialog — Action confirmation
- Drawer — Slide-out panels
- Bottom Sheet — iOS-style bottom sheet: snap points, swipe, peek mode
Previous: Popover · Next: Tour · All Overlays and notifications