--- title: Preview Card description: A popup that appears when a link is hovered, showing a preview for sighted users. links: doc: https://base-ui.com/react/components/preview-card#api-reference --- ## Installation CLI Manual ```bash npx shadcn@latest add @coss/preview-card ``` Install the following dependencies: ```bash npm install @base-ui/react ``` Copy and paste the following code into your project. Update the import paths to match your project setup. ## Usage ```tsx import { Button } from "@/components/ui/button" import { PreviewCard, PreviewCardPopup, PreviewCardTrigger, } from "@/components/ui/preview-card" ``` ```tsx Open Preview Card Preview Card Content ``` ## 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. Also exported as `HoverCardContent`. | Prop | Type | Default | Description | | ------------- | ------------------------------ | ---------- | ------------------------------------------------ | | `align` | `"start" \| "center" \| "end"` | `"center"` | Alignment relative to the trigger | | `sideOffset` | `number` | `4` | Distance from the trigger in pixels | | `portalProps` | `PreviewCard.Portal.Props` | - | Props forwarded to the internal portal (`keepMounted`, `container`, etc.); see Base UI Preview Card portal API |