Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Profile with Badge Hover Card for Solid

Hayden Bleasel, with a small avatar, opens a profile card that adds a Pro badge, a role, and Joined March 2020.

UI library: Ark UI

The trigger pairs a small avatar with Hayden Bleasel. The card shows a larger avatar, the name, a Pro badge, Product designer and developer, and Joined March 2020.

Put it on authors in a feed when plan or role matters. On a phone, open the same card from a Popover. In Solid, Ark UI does not load a profile. The name and date are written here.

Preview

Preview width

Installation

MCP · Pro
Make your AI a shadcn expert
Your agent installs components, builds pages and restyles your app from one prompt, in Claude Code, Cursor or VS Code.
Part of Pro

Anatomy

Hover Card anatomy: trigger, positioner, arrow, content

Usage

<HoverCard>
    <HoverCardTrigger asChild={props => <a {...props({
    "class": "flex items-center gap-2 font-medium text-sm"
  })} href="#">
        <Avatar size="sm">
          <AvatarImage alt="@haydenbleasel" height={24} src="https://github.com/haydenbleasel.png" width={24} />
          <AvatarFallback>HB</AvatarFallback>
        </Avatar>
        <span>Hayden Bleasel</span>
      </a>} />
    <HoverCardContent>
      <div class="flex gap-4">
        <Avatar>
          <AvatarImage alt="@haydenbleasel" height={32} src="https://github.com/haydenbleasel.png" width={32} />
          <AvatarFallback>HB</AvatarFallback>
        </Avatar>
        <div class="flex flex-1 flex-col gap-1">
          <div class="flex items-center gap-2">
            <h4 class="font-semibold text-sm">Hayden Bleasel</h4>
            <Badge variant="secondary">Pro</Badge>
          </div>
          <p class="text-muted-foreground text-sm">
            Product designer and developer
          </p>
          <p class="text-muted-foreground text-xs">Joined March 2020</p>
        </div>
      </div>
    </HoverCardContent>
  </HoverCard>

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 the name link through its asChild function.

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. Set openDelay and closeDelay on HoverCard; they default to 10 and 100. positioning picks another side than the bottom.

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.

API Reference

Hover Card

Sets asChild and props. The rest is on the Hover Card page.

Avatar

Sets size="sm", alt="@haydenbleasel", height={24}, src="https://github.com/haydenbleasel.png", width={24} and height={32}. The rest is on the Avatar page.

Badge

Sets variant="secondary". The rest is on the Badge page.