Components
- Accordion
- Alert
- Alert Dialog
- Autocomplete
- Avatar
- Badge
- Breadcrumb
- Button
- Card
- Checkbox
- Checkbox Group
- Collapsible
- Combobox
- Dialog
- EmptyNew
- Field
- Fieldset
- Form
- Frame
- Group
- Input
- Input GroupNew
- KbdNew
- Label
- Menu
- Meter
- Number Field
- Pagination
- Popover
- Preview Card
- Progress
- Radio Group
- Scroll Area
- Select
- Separator
- Sheet
- SkeletonNew
- Slider
- SpinnerNew
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Toolbar
- Tooltip
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" />}>
coss.com/ui
</PreviewCardTrigger>
<PreviewCardPopup>
<div className="flex flex-col gap-4">
<div className="flex flex-col gap-1">
<h4 className="font-medium text-sm">coss.com/ui</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 @coss/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>Comparing with Radix / shadcn
If you’re already familiar with Radix UI and shadcn/ui, this guide highlights the small differences and similarities so you can get started with coss ui quickly.
Quick Checklist
- Update import path from
@/components/ui/hover-card→@/components/ui/preview-card - Prefer
PreviewCard*component names;HoverCard*remain for legacy - Prefer
PreviewCardPopupinstead ofHoverCardContent - If you used
asChildon parts, switch to therenderprop
Comparison Example
<HoverCard>
<HoverCardTrigger asChild>
<Button variant="outline">Open Preview Card</Button>
</HoverCardTrigger>
<HoverCardContent>Preview Card Content</HoverCardContent>
</HoverCard><PreviewCard>
<PreviewCardTrigger render={<Button variant="outline" />}>
Open Preview Card
</PreviewCardTrigger>
<PreviewCardPopup>Preview Card Content</PreviewCardPopup>
</PreviewCard>