Pho Design System

Preview Card

A hover-triggered card that previews what’s behind a link — a profile, a repo, an article. Built on Base UI PreviewCard. Like a Tooltip it opens on hover/focus, but it holds richer (still non-essential) content.

Import

import { PreviewCard } from "@photon-ai/pho-ui/components/preview-card";

Basic

Wrap an inline link with PreviewCard.Trigger (pass the link through render); the card opens after a short hover and the link stays fully clickable.

Built and maintained by @photon.

<PreviewCard.Root>
  <PreviewCard.Trigger render={<a href="/photon">@photon</a>} />
  <PreviewCard.Portal>
    <PreviewCard.Positioner>
      <PreviewCard.Popup>
        <Avatar.Root>…</Avatar.Root>
        <div>Photon — the deployment platform.</div>
      </PreviewCard.Popup>
    </PreviewCard.Positioner>
  </PreviewCard.Portal>
</PreviewCard.Root>

Placement

PreviewCard.Positioner sets where the card sits: side picks the edge (bottom by default), align sets alignment along it, and sideOffset is the gap — defaulted to 8 here. Placement flips automatically when the chosen side would overflow the viewport.

Read the changelog to see what shipped.

<PreviewCard.Positioner side="top">
  <PreviewCard.Popup>…</PreviewCard.Popup>
</PreviewCard.Positioner>

Anatomy

Props

Every part also accepts className and render (Base UI’s prop for swapping the underlying element).

PreviewCard.Root (holds state; renders no element)

PreviewCard.Trigger (<a>)

PreviewCard.Positioner (<div>)

PreviewCard.Popup (<div>) takes only the common className / render.

Accessibility

Best practices