shadcn.io is not affiliated with official shadcn/ui
Hover Card examples · Profile
Profile with Follow Button Hover Card for React
A username that opens a profile card with follower counts and a Follow button.
A username opens a profile card with the avatar, name, role, follower and following counts, and a full-width Follow button. People can follow someone without leaving the page they are on.
Preview
Installation
FAQ
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.
Does Follow do anything?
Not in the demo. Handle its press and switch it to Following when it succeeds. The card stays open while the pointer is inside it, so the button can be reached.
How wide is the card?
The default hover card width. Set a width class such as w-80 on the card to fit longer content.
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. Tab then moves into the card, to the Follow button. 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
- Simple Profile Hover CardA username that opens a small card with
- Profile with Stats Hover CardA username that opens a profile card with
- Profile with Badge Hover CardA name with a small avatar that opens a
- Profile with Location Hover CardA username that opens a profile card with
- Info with Icon and Badge Hover CardA Verified badge that opens a card
- Info with Title Hover CardAn info icon beside a label that opens a