Skip to content

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

Financial Stats Hover Card for Solid

A Monthly Revenue tile for $45.2k opens income, expenses, net profit, and the change versus last month.

UI library: Ark UI

The tile shows a dollar icon, $45.2k, and Monthly Revenue. The card is titled Revenue Breakdown: income $52.8k, expenses $7.6k, net profit $45.2k, and +18.2% vs. last month.

Reach for it on a dashboard when a headline number needs its parts. A tap should open a Popover instead. In Solid, Ark UI does not calculate these figures. They are written in the demo.

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 => <button {...props({
    "class": "flex items-center gap-2 rounded-lg border bg-card p-4 text-start hover:bg-accent"
  })} type="button">
        <DollarSignIcon aria-hidden="true" class="size-5 text-success" />
        <div>
          <div class="font-bold text-2xl">$45.2k</div>
          <div class="text-muted-foreground text-sm">Monthly Revenue</div>
        </div>
      </button>} />
    <HoverCardContent class="w-80">
      <div class="flex flex-col gap-3">
        <h4 class="font-semibold text-sm">Revenue Breakdown</h4>
        <div class="flex flex-col gap-2 text-sm">
          <div class="flex items-center justify-between rounded-md bg-muted p-2">
            <div class="flex items-center gap-2">
              <ArrowUpIcon aria-hidden="true" class="size-4 text-success" />
              <span class="text-muted-foreground">Income</span>
            </div>
            <span class="font-medium">$52.8k</span>
          </div>
          <div class="flex items-center justify-between rounded-md bg-muted p-2">
            <div class="flex items-center gap-2">
              <ArrowDownIcon aria-hidden="true" class="size-4 text-destructive" />
              <span class="text-muted-foreground">Expenses</span>
            </div>
            <span class="font-medium">$7.6k</span>
          </div>
          <div class="flex items-center justify-between pt-2">
            <span class="text-muted-foreground">Net Profit</span>
            <span class="font-bold text-lg text-success">$45.2k</span>
{/* The rest of the file is under Installation. */}

FAQ

What is in the card?

Revenue Breakdown, Income $52.8k with an up arrow, Expenses $7.6k with a down arrow, Net Profit $45.2k in large text, and +18.2% vs. last month.

How is the stat tile made the trigger?

HoverCardTrigger renders the stat tile through its asChild function.

How are gains and losses colored?

With tokens: text-success for the up arrow and the net profit, text-destructive for the down arrow. The arrows also carry the meaning, so color isn't the only cue.

How wide is the card?

w-80 on the card, for the extra content. The class is on HoverCardContent.

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