shadcn.io is not affiliated with official shadcn/ui
Hover Card examples · Preview
Event Preview Hover Card for React
An event name that opens a card with its status, description, date, time and attendees.
An event name opens a card with an Upcoming badge, a short description and three lines for the date, the time and the number of attendees. Use it in calendars, agendas and activity feeds where the name alone isn't enough.
Preview
Installation
FAQ
What is in the card?
The title with an Upcoming Badge, the description, then a calendar, a clock and a people icon, each beside its detail: Monday, January 15, 2024, 2:00 PM - 3:30 PM (90 min) and 12 attendees.
How is the event name made the trigger?
HoverCardTrigger takes the event name through render, a button with its classes.
Should the event name be a link?
Make it a link when it leads to the event's page. The demo uses a button because it only opens the preview.
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 event 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.
Related
- Document Preview Hover CardA file link that opens a preview card
- Link Preview Hover CardA link inside a sentence that opens a
- Profile with Location Hover CardA username that opens a profile card with
- Product Preview Hover CardA product link that opens a card with its
- Image Preview Hover CardA file name that opens a card with a
- Info with Icon and Badge Hover CardA Verified badge that opens a card