Preview Card
Optional profile, repository, term or product previews shown from a hoverable and focusable trigger.
Purpose
Use Preview Card for optional supporting previews such as profiles, repositories, terms or products that appear from a hoverable and focusable trigger.
Hover preview
Installation
With the Siteplane registry alias configured, add the component and import the installed source from your app.
CLI
pnpm dlx shadcn@4.16.1 add @siteplane/preview-cardImport
import {
PreviewCard,
PreviewCardTrigger,
PreviewCardPopup,
} from "@/components/ui/preview-card";Need the machine-readable source metadata? View registry JSON.
Usage
Preview Card reveals contextual preview content on hover or focus without changing the current page. Keep the trigger a real link so keyboard users can open it too.
import { Button } from "@/components/ui/button";
import { PreviewCard, PreviewCardPopup, PreviewCardTrigger } from "@/components/ui/preview-card";
export function Example() {
return (
<PreviewCard>
<PreviewCardTrigger render={<Button variant="link" />}>Hover project</PreviewCardTrigger>
<PreviewCardPopup>Project summary</PreviewCardPopup>
</PreviewCard>
);
}Examples
Rich popup content, trigger elements, width overrides and popup positioning are compositions and props of the same primitive.
Inline link
User card
Repo card
Custom trigger
Custom width
Alignment
API Reference
The reference lists the source-owned exports and props that are easy to miss in visual examples. Inherited Base UI props remain available unless the wrapper narrows them.
- Compose
PreviewCard,PreviewCardTriggerandPreviewCardPopup. PreviewCardTriggerrenders a link by default and accepts Base UI'srenderprop for another interactive element.PreviewCardPopupaccepts placement props includingside,align,sideOffsetandanchor;anchorcan point at a different element or virtual position.- Keep popup content compact and non-essential because it is supplementary to the trigger's destination.
Motion
Component motion uses the shared Siteplane motion contract. See the global motion guide for provider setup, tokens and reduced-motion behavior.
- The popup uses the native Siteplane floating-panel scale and opacity transition.
- Open delay, close behavior and reduced motion remain controlled by the Preview Card primitive and global motion layer.
Accessibility
- The trigger must be an interactive element with its own accessible name and keyboard focus.
- The preview opens from both hover and focus; preserve Escape behavior.
- Images need useful alt text or a text fallback, and any popup action needs a clear accessible name.
Implementation Guidance
- Never put required instructions, validation or critical status only inside a Preview Card.
- Do not render a popup without an interactive trigger or a deliberate
anchorrelationship. - Use Popover instead when the floating content itself is the primary interactive task.