Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Autocomplete
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Checkbox Group
- Collapsible
- Combobox
- Command
- Context Menu
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Fieldset
- Form
- Frame
- Group
- Input
- Input Group
- Kbd
- Label
- Menu
- Menubar
- Message
- Meter
- Number Field
- OTP Field
- Pagination
- Popover
- Preview Card
- Progress
- Questionnaire
- Radio Group
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toggle
- Toggle Group
- Toolbar
- Tooltip
Shared
- Artifact
- Audio Player
- Canvas
- Chain of Thought
- Checkpoint
- Code Block
- Commit
- Connection
- Context
- Controls
- Edge
- Environment Variables
- Mic Selector
- Model Selector
- Node
- Node Toolbar
- Open in Chat
- Panel
- Plan
- Prompt Input
- Queue
- Reasoning
- Sandbox
- Schema Display
- Shimmer
- Snippet
- Sources
- Speech Input
- Stack Trace
- Suggestion
- Tool
- Transcription
- Web Preview
Hooks
Resources
Preview Card
A popup that appears when a link is hovered, showing a preview for sighted users.
import { CornerUpLeftIcon, StarIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import {
PreviewCard,
PreviewCardPopup,
PreviewCardTrigger,
} from "@/components/ui/preview-card";
export default function Particle() {
return (
<PreviewCard>
<PreviewCardTrigger render={<Button variant="ghost" />}>frontal.dev</PreviewCardTrigger>
<PreviewCardPopup>
<div className="flex flex-col gap-4">
<div className="flex flex-col gap-1">
<h4 className="font-medium text-sm">frontal.dev</h4>
<p className="text-muted-foreground text-sm">
Beautifully designed components that you can copy and paste into your apps.
</p>
</div>
<div className="flex items-center gap-4 text-muted-foreground text-xs">
<div className="flex items-center gap-1">
<span aria-hidden="true" className="size-2 rounded-full bg-blue-500" />
<span>TypeScript</span>
</div>
<div className="flex items-center gap-1">
<StarIcon className="size-3" />
<span>58.2k</span>
</div>
<div className="flex items-center gap-1">
<CornerUpLeftIcon className="size-3" />
<span>5.1k</span>
</div>
</div>
</div>
</PreviewCardPopup>
</PreviewCard>
);
}
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.
| Prop | Type | Default | Description |
|---|---|---|---|
align | "start" | "center" | "end" | "center" | Alignment relative to the trigger |
sideOffset | number | 4 | Distance from the trigger in pixels |
anchor | PreviewCard.Positioner.Props["anchor"] | - | Element the popup is anchored to |
dark | boolean | true | Renders the surface with the dark palette |
portalProps | PreviewCard.Portal.Props | - | Props forwarded to the internal portal (keepMounted, container, etc.); see Base UI Preview Card portal API |
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.