shadcn.io is not affiliated with official shadcn/ui
Hover Card examples · Profile
Profile with Stats Hover Card for React
A username that opens a profile card with posts, followers and following counts.
A username opens a profile card with a large avatar, the name and role, then a Separator and three counts: posts, followers and following. Use it for social and community profiles where activity is the point.
Preview
Installation
FAQ
What is in the card?
A large Avatar, Hayden Bleasel and Product designer and developer, a separator, and a three-column grid: 243 Posts, 2.5k Followers and 180 Following.
How is the username link made the trigger?
HoverCardTrigger renders an anchor itself, so the username link is the trigger with href and its classes set on it.
How are the counts rendered?
From a list of label and value pairs at the top of the file, mapped to one column each and keyed by the label. Replace it with your own counts.
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 username 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
- Profile with Follow Button Hover CardA username that opens a profile card with
- Profile with Location Hover CardA username that opens a profile card with
- User Stats Hover CardAn active users tile that opens new
- Simple Profile Hover CardA username that opens a small card with
- Profile with Badge Hover CardA name with a small avatar that opens a
- Info with Icon and Badge Hover CardA Verified badge that opens a card