Skip to content

Preview Card

A popup that appears when a link is hovered, showing a preview for sighted users.

API Reference

Installation

pnpm dlx shadcn@latest add @frontal-labs/preview-card

Usage

import { Button } from "@/components/ui/button";
import { PreviewCard, PreviewCardPopup, PreviewCardTrigger } from "@/components/ui/preview-card";
<PreviewCard>
  <PreviewCardTrigger>Open Preview Card</PreviewCardTrigger>
  <PreviewCardPopup>Preview Card Content</PreviewCardPopup>
</PreviewCard>

API Reference

PreviewCard

Root component. Alias for PreviewCard.Root from Base UI.

PreviewCardTrigger

Trigger element that shows the preview card on hover. Alias for PreviewCard.Trigger from Base UI.

PreviewCardPopup

Popup container that displays the preview content. The surface is elevated with shadow-menu and surface-ring.

About dark: the preview card uses the dark palette by default. Pass dark={false} to follow the ambient theme instead. dark applies .dark to the positioner inside the portal, so the tokens inherit down to the popup and everything within it.