Hover card

Displays a quick preview of related content when users hover over an element.

@radix-ui/react-hover-card

lucide-react

Installation


1

Install the following dependencies:

npx shadcn@latest add https://sbthemes.com/r/hover-card.json

Examples

This component is based on the <button> element and supports all of its props and adds:


Position

Align


API Reference

Root

Contains all the parts of a hover card.

PropTypeDefault
defaultValueboolean-
openboolean-
onOpenChangefunction-
openDelaynumber700
closeDelaynumber300

Trigger

The link that opens the hover card when hovered.

PropTypeDefault
asChildbooleanfalse
Data attributeValues
[data-state]open, close

Content

The component that pops out when the hover card is open.

PropTypeDefault
asChildbooleanfalse
sidestringbottom
sideOffsetnumber0
alignstringcenter
alignOffsetnumber0
Data attributeValues
[data-state]open, close
[data-side]left , right , bottom ,top
[data-align]start , end , center