shadcn.io is not affiliated with official shadcn/ui
Hover Card examples · Info
Technical Info Hover Card for React
A code icon beside a label that opens the endpoint's method, URL and authentication.
A code icon beside API Endpoint opens a card with the endpoint's details: the method and URL in code style, and the authentication it needs. Use it in API dashboards and developer settings where the details are useful but not always needed.
Preview
Installation
FAQ
What is in the card?
The title Endpoint Details and three lines: Method GET and URL /api/v1/users in small code chips on bg-muted, and Auth: Bearer Token Required.
How is the code icon made the trigger?
HoverCardTrigger takes the code icon through render, a button with its classes.
How is the icon button named?
The CodeIcon is hidden from assistive tech, so the button carries aria-label="Endpoint details".
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 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.
Related
- Info with Title Hover CardAn info icon beside a label that opens a
- Simple Info Tooltip Hover CardA help icon beside a label that opens a
- Document Preview Hover CardA file link that opens a preview card
- Performance Stats Hover CardAn uptime badge that opens a system
- Info with Icon and Badge Hover CardA Verified badge that opens a card
- Warning Info Hover CardA warning banner whose Details link opens