Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Hover Card examples · Profile

Profile with Badge Hover Card for React

A name with a small avatar that opens a profile card with a Pro badge and join date.

Framework
UI library

A name with a small avatar opens a profile card: a larger avatar, the name with a Pro badge, the role and the join date. Use it for authors and members in feeds and comments where their plan or role matters.

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?

An Avatar, Hayden Bleasel beside a secondary Pro Badge, Product designer and developer, and Joined March 2020.

How is the name link made the trigger?

HoverCardTrigger renders an anchor itself, so the name link is the trigger with href and its classes set on it.

How is the avatar in the trigger made small?

size="sm" on Avatar. The one in the card uses the default size. Each image has the username as its alt, and AvatarFallback shows HB if it fails to load.

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 name 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.