shadcn.io is not affiliated with official shadcn/ui
Hover Card examples · Preview
Product Preview Hover Card for React
A product link that opens a card with its price, description, rating and stock.
A product name opens a card with a thumbnail, the sale price beside the old one, a description, the rating and the stock. Use it in carts, comparisons and recommendations where people want details without leaving the page.
Preview
Installation
FAQ
What is in the card?
A package icon in a muted square, the name, $299 beside $349 struck through, the description, a star with 4.8 (2,431 reviews) and In Stock.
How is the product link made the trigger?
HoverCardTrigger renders an anchor itself, so the product link is the trigger with href and its classes set on it.
How are the rating and the stock colored?
The star is filled with the warning token and In Stock uses text-success, so both follow the theme.
How wide is the card?
w-80 on the card, for the extra content.
The class is on HoverCardContent.
max-w-full keeps it inside narrow screens.
How do I change how fast the card opens and closes?
The card opens a moment after the pointer rests on the trigger and stays up long enough for the pointer to move into it. Both delays are in milliseconds.
The demo sets delay 10 and closeDelay 100 on HoverCardTrigger. side and align on HoverCardContent place it.
Does the card open from the keyboard and on touch screens?
Focusing the link opens the card, moving focus away or pressing Escape closes it. Touch screens have no hover, so keep what matters reachable elsewhere, or use a Popover when the card has to open on a tap.
Related
- Image Preview Hover CardA file name that opens a card with a
- Document Preview Hover CardA file link that opens a preview card
- Link Preview Hover CardA link inside a sentence that opens a
- Financial Stats Hover CardA revenue tile that opens a breakdown of
- Event Preview Hover CardAn event name that opens a card with its
- Info with Icon and Badge Hover CardA Verified badge that opens a card