On this page

Hover card

Live examples of Hover card, with the exact Vue file that renders each one.

Every example is a complete Vue file. Copy it into an app that has the registry installed, or open it in StackBlitz. Rest the pointer on a link, or Tab to it.

A person

A customer name in a CRM list. The link opens the customer; the card shows who it is first.

Last order placed by Lan Pham.

HoverCardCustomer.vue
<script setup lang="ts">
import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/components/ui/hover-card'

// A customer name in a CRM list. The link opens the customer; the card previews who it is.
const customer = { name: 'Lan Pham', initials: 'LP', email: '[email protected]', orders: 12, since: 'March 2024' }
</script>

<template>
  <p class="text-(--bh-color-text) [font:var(--bh-font-body-default)]">
    Last order placed by
    <HoverCard>
      <HoverCardTrigger as-child>
        <a href="#customer" class="text-(--bh-color-link) underline underline-offset-2 hover:text-(--bh-color-link-hover)">{{ customer.name }}</a>
      </HoverCardTrigger>
      <HoverCardContent class="flex gap-(--bh-space-150)">
        <span aria-hidden="true" class="inline-flex size-(--bh-size-control-large) shrink-0 items-center justify-center rounded-(--bh-radius-pill) bg-(--bh-color-background-neutral) text-(--bh-color-text) [font:var(--bh-font-label-default)]">{{ customer.initials }}</span>
        <div class="grid gap-(--bh-space-025)">
          <span class="text-(--bh-color-text) [font:var(--bh-font-heading-xsmall)]">{{ customer.name }}</span>
          <span class="text-(--bh-color-text-subtle)">{{ customer.email }}</span>
          <span class="text-(--bh-color-text-subtle)">{{ customer.orders }} orders · Customer since {{ customer.since }}</span>
        </div>
      </HoverCardContent>
    </HoverCard>.
  </p>
</template>

A record

An order number in a sync log, with the order’s store, status, items and total.

10:42 · Order SO-10482 copied to the ERP.

HoverCardOrder.vue
<script setup lang="ts">
import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/components/ui/hover-card'

// An order number in a sync log. Hover or focus it to see the order without leaving the log.
const order = { id: 'SO-10482', store: 'Online store', status: 'Paid, waiting to ship', items: 3, total: '$248.00' }
</script>

<template>
  <p class="text-(--bh-color-text) [font:var(--bh-font-body-default)]">
    10:42 · Order
    <HoverCard>
      <HoverCardTrigger as-child>
        <a href="#order" class="text-(--bh-color-link) underline underline-offset-2 hover:text-(--bh-color-link-hover) [font:var(--bh-font-code-default)]">{{ order.id }}</a>
      </HoverCardTrigger>
      <HoverCardContent side="bottom" align="start">
        <dl class="m-0 grid grid-cols-[auto_1fr] [&_dd]:m-0 gap-x-(--bh-space-200) gap-y-(--bh-space-050)">
          <dt class="text-(--bh-color-text-subtle)">Store</dt><dd>{{ order.store }}</dd>
          <dt class="text-(--bh-color-text-subtle)">Status</dt><dd>{{ order.status }}</dd>
          <dt class="text-(--bh-color-text-subtle)">Items</dt><dd>{{ order.items }}</dd>
          <dt class="text-(--bh-color-text-subtle)">Total</dt><dd>{{ order.total }}</dd>
        </dl>
      </HoverCardContent>
    </HoverCard>
    copied to the ERP.
  </p>
</template>