Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Hover Card examples · Info

Info with Title Hover Card for React

An info icon beside a label that opens a titled card listing the API rate limits per plan.

Framework
UI library

An info icon next to a label, API Rate Limit, opens a card with a title and the limit for each plan. Use it for settings and pricing details that need more than a tooltip's single line but shouldn't clutter the page.

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?

The title Rate Limiting and a muted paragraph with one line per plan: Free, Pro and Enterprise, separated by line breaks.

How is the info icon made the trigger?

HoverCardTrigger takes the info icon through render, a button with its classes.

How is the icon button named?

The InfoIcon is hidden from assistive tech, so the button carries aria-label="About API rate limits". Name it after what the card explains.

Should this be a tooltip instead?

A Tooltip suits one short line. This card has a title and several lines, which a hover card holds better, and its text can be selected.

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 icon button opens the card, moving focus away or pressing Escape closes it. The icon button carries an aria-label, so it is announced by name. Touch screens have no hover, so keep what matters reachable elsewhere, or use a Popover when the card has to open on a tap.