Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Hover Card examples · Profile

Profile with Location Hover Card for React

A username that opens a profile card with a bio, location and join year.

Framework
UI library

A username opens a wider profile card: a large avatar, the name and handle, a bio, and a row with the location and join year. Use it for communities and marketplaces where where someone is and how long they've been around matter.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

FAQ

What is in the card?

A large Avatar, Hayden Bleasel and @haydenbleasel, the bio, then a pin with San Francisco and a calendar with Joined 2020.

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 is the avatar made large?

size="lg" on Avatar. The image has the username as its alt, and AvatarFallback shows HB if it fails to load.

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.