Hover card
A preview of a person, place or file while the pointer rests on its link.
Installation
npm i @uisatin/uiimport { HoverCard } from '@uisatin/ui/hover-card'About 28.2 kB of JavaScript, minified and gzipped, with what it imports (React aside). The stylesheet is one file for every component.
npx shadcn@latest add https://uisatin.dev/r/hover-card.json https://uisatin.dev/r/avatar.jsonAdds hover-card.tsx, avatar.tsx, kbd.tsx and tooltip.tsx to components/ui and installs radix-ui.
First time with Satin? Set it up once, styles and fonts included, with the installation guide.
API Reference
The HoverCard component opens after the pointer rests 400 ms on its trigger (NN/g recommends 0.3–0.5 s) and closes 150 ms after it leaves; keyboard focus opens it too.
| Prop | Type | Default |
|---|---|---|
trigger | ReactNode | — |
children | ReactNode | — |
openDelay | number | 400 |
closeDelay | number | 150 |
side | "top""right""bottom""left" | "bottom" |
align | "start""center""end" | "start" |
open | boolean | — |
defaultOpen | boolean | false |
onOpenChange | (open: boolean) => void | — |
className | string | — |
ref | Ref<HTMLElement> | — |
...props | ComponentProps<typeof HoverCard.Content>Other attributes go to the Radix HoverCard.Content part | — |
Accessibility
A Radix hover card. It opens when the trigger is hovered or focused, after openDelay, and closes after closeDelay. The card is not in the tab order and is not linked to the trigger, so keyboard and screen-reader users don’t reach what is inside: keep it to extra context the page works without.
| Key | Action |
|---|---|
| Tab | Focusing the trigger opens the card after openDelay; moving on closes it. |
| Esc | Closes the card. |
Something wrong or missing on this page?
Report a problemSuggest an improvement