Hover Card

Hover card that springs out of its trigger after an open delay and stays open while the pointer travels into it; also opens on keyboard focus, closes on Escape or blur, and flips and aligns on any side to stay in the viewport, while touch taps simply follow the link.

Preview

Hover Card preview width

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @karaui/hover-card
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

HoverCard

open?
boolean

Controlled open state.

—
defaultOpen?
boolean

Uncontrolled initial open state.

false
onOpenChange?
((open: boolean) => void)
—
openDelay?
number

Hover time before the card opens, in ms. Default 500.

500
closeDelay?
number

Time after the pointer leaves before the card closes, in ms. Default 300.

300
className?
string
—

HoverCardTrigger

children
ReactElement<TriggerChildProps, string | JSXElementConstructor<any>>

A single focusable element, usually an `<a>`. Its own handlers still run.

—
className?
string
—

HoverCardContent

side?
"bottom" | "left" | "right" | "top"

Preferred side; flips when the viewport lacks room. Default "bottom".

bottom
align?
"end" | "start" | "center"

Default "center".

center
sideOffset?
number

Gap between trigger and card, in px. Default 8.

8
alignOffset?
number
0
className?
string
—

Updated