Skip to content

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

Free

Event Preview Hover Card for Vue

Team Planning Session opens a card with an Upcoming badge, a short description, the date, a 90 minute slot, and 12 attendees.

UI library: Ark UI

The trigger is the name Team Planning Session. The card adds an Upcoming badge, a description of the quarterly planning meeting, Monday, January 15, 2024, 2:00 PM to 3:30 PM, and 12 attendees.

It belongs on a calendar or an agenda when the name is not enough. Touch screens have no hover, so a Popover is the stand-in. In Vue, Ark UI keeps the card open while the pointer moves onto it.

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="true">
    <button class="font-medium text-sm underline underline-offset-4" type="button">
      Team Planning Session
    </button>
  </HoverCardTrigger>
  <HoverCardContent class="w-80">
    <div class="flex flex-col gap-3">
      <div class="flex items-center justify-between">
        <h4 class="font-semibold text-sm">Team Planning Session</h4>
        <Badge variant="secondary">Upcoming</Badge>
      </div>
      <p class="text-muted-foreground text-sm">
        Quarterly planning meeting to discuss goals, priorities, and team alignment for Q1.
      </p>
      <div class="flex flex-col gap-2 text-muted-foreground text-sm">
        <div class="flex items-center gap-2">
          <CalendarIcon aria-hidden="true" class="size-4" />
          <span>Monday, January 15, 2024</span>
        </div>
        <div class="flex items-center gap-2">
          <ClockIcon aria-hidden="true" class="size-4" />
          <span>2:00 PM - 3:30 PM (90 min)</span>
        </div>
        <div class="flex items-center gap-2">
          <UsersIcon aria-hidden="true" class="size-4" />
          <span>12 attendees</span>
        </div>
      </div>
    </div>
  </HoverCardContent>
</HoverCard>

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 as-child, and the demo passes the event name.

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

API Reference

Hover Card

Sets asChild. The rest is on the Hover Card page.

Badge

Sets variant="secondary". The rest is on the Badge page.