Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Hover Card examples · Stats

Financial Stats Hover Card for React

A revenue tile that opens a breakdown of income, expenses and net profit.

Framework
UI library

A Monthly Revenue tile opens a breakdown: income and expenses on muted rows with up and down arrows, the net profit, and the change from last month. Use it on dashboards where the headline number needs its parts on demand.

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?

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 takes the stat tile through render, a button with its classes.

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