Components

Hover Card

A small polaroid that appears when you rest the pointer on a link or move keyboard focus to it: photo stock with a thick lower margin for handwriting, a degree or two of tilt, and tape if you like. A preview for sighted pointer users, never the only home of anything.

Install

terminal
npx shadcn@latest add @wobko/hover-card

First time here? Add the registry to components.json first. How to install

Examples

Profile

The shadcn demo as a polaroid: hover the link (or tab to it) and a small photo with handwriting on its margin lands next to it.

Taped, with a sticker

The window holds any art: here a die-cut sticker, and the polaroid is taped down by a strip of washi across the top.

Delays and sides

openDelay and closeDelay tune how eager the card is (the default 700 / 300 ms is deliberate: a card that pops up on every pass of the pointer is noise). `side` and `align` are Radix's: left and right cards start level with their link, so none rises above the page.

Mentions in prose

The real use: names in a paragraph that unfold into a card. Every mention is a real link that works without the card (touch, keyboard, no JS), and the card is a bonus for the pointer.

Plain content

shadcn's `hover-card-demo`, written the way the original is: HoverCardContent with a width and ordinary children (an avatar, a name, a sentence and a date), none of the polaroid parts. The window is still a small photo-stock sheet, and it still only opens for a pointer.

API reference

HoverCardContent

The polaroid: a Paper on photo stock that is also the Radix hover card content (a CSS sheet, no SVG). It takes every Radix Content prop and these.

PropTypeDefaultDescription
sideOffsetnumber8Gap between the trigger and the card (upstream's default is 4: a polaroid needs room for its shadow and tape). The card is also capped to the viewport width.
collisionPaddingnumber | Partial<Record<Side, number>>8Room kept between the card and the viewport edge when it has to shift to fit (upstream's default is 0).
stockStockName"photo"What it is printed on.
tape"corner" | "top" | "both" | falsefalseTape across the top edge or corners.
edgeEdgeSpec"cut"Cut (pure CSS), torn, deckle, ...
tiltboolean | numbertrueSeeded tilt of the sheet (photo stock turns up to 1.5 degrees); text stays upright.
seedstring | number-Pins the hand.

Accessibility

  • Radix HoverCard opens on pointer hover and on keyboard focus of the trigger, closes on blur and on Escape, and lets the pointer travel from the trigger into the card. It is not announced to screen readers as a dialog: treat it as a preview of information that is also available by following the link.
  • Touch: hover cards never open on a tap (Radix ignores touch pointers). The trigger must work on its own as a link; use a Popover when the content needs to be reachable on a phone.
  • The recess frame and tape are aria-hidden decoration. Give the media an accessible name if it carries meaning.
  • Portalled content repeats the InkProvider's `data-density`, `data-motion` and `data-theme`; with reduced motion it appears without the zoom.

Source

The files the CLI copies into your project.

Loading the source