Hover Card

A preview that opens on hover or focus.

Install and use

The first command adds the component and the Mine theme, the second adds this example. Render <Mine> once near your root for the skin, sounds and narrator.

"use client"

import {
  HoverCard,
  HoverCardContent,
  HoverCardTrigger,
} from "@/components/ui/hover-card"

function Example() {
  return (
    <HoverCard>
      <HoverCardTrigger href="https://example.com/people/hollis">
        @hollis
      </HoverCardTrigger>
      <HoverCardContent>
        <div data-slot="row">
          <span data-slot="initials" aria-hidden="true">
            HG
          </span>
          <div data-slot="stack">
            <p>Hollis Grant</p>
            <p>
              Design engineer on the payments team. Writes about forms and
              motion.
            </p>
            <p data-slot="hint">Joined March 2021</p>
          </div>
        </div>
      </HoverCardContent>
    </HoverCard>
  )
}

export { Example }