Product Card
poyraz/product-cardFreeBlock
Poyraz Soft Glass product-card with semantic states and composable variants.
Install it
npx shadcn@latest add https://ui.poyrazavsever.com/r/product-card.jsonSource
1import * as React from "react";2import { Badge } from "@/components/ui/atoms/badge";3import {4 Card,5 CardFooter,6 CardHeader,7 CardHeading,8 CardImage,9 CardTitle,10 type CardProps,11} from "@/components/ui/atoms/card";12import { StarRating } from "@/components/ui/blocks/card-templates/star-rating";13import { cn } from "@/lib/utils";1415export interface ProductCardProps extends Omit<CardProps, "title"> {16 image: string;17 title: string;18 price: string;19 originalPrice?: string;20 rating?: number;21 badge?: string;22 action?: React.ReactNode;23 href?: string;24}25const ProductCard = React.forwardRef<HTMLDivElement, ProductCardProps>(26 (27 { action, badge, className, href, image, originalPrice, price, rating, title, ...props },28 ref,29 ) => {30 const content = (31 <Card32 ref={ref}33 variant="interactive"34 className={cn("group overflow-hidden", className)}35 {...props}36 >37 <CardImage className="relative">38 <img39 src={image}40 alt=""41 className="size-full object-cover transition-transform duration-300 group-hover:scale-[1.03]"42 />43 {badge && <Badge className="absolute right-2 top-2">{badge}</Badge>}44 </CardImage>45 <CardHeader>46 <CardHeading>47 <CardTitle className="line-clamp-1">{title}</CardTitle>48 {rating != null && <StarRating rating={rating} />}49 <div className="flex items-baseline gap-2">50 <span className="font-semibold">{price}</span>51 {originalPrice && (52 <span className="text-xs text-muted-foreground line-through">{originalPrice}</span>53 )}54 </div>55 </CardHeading>56 </CardHeader>57 {action && <CardFooter>{action}</CardFooter>}58 </Card>59 );60 return href ? (61 <a href={href} className="block text-inherit no-underline">62 {content}63 </a>64 ) : (65 content66 );67 },68);69ProductCard.displayName = "ProductCard";70export { ProductCard };
What it pulls in
Other registry items
Files it writes
More from poyraz
All 71 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Article Cardarticle-card | poyraz | Blocks | Free | no deps | |
| Auth Card Blockauth-card-block | poyraz | Blocks | Free | 1 dep | |
| Brand Hero Blockbrand-hero-block | poyraz | Blocks | Free | 1 dep | |
| Dashboard Shell Blockdashboard-shell-block | poyraz | Blocks | Free | 1 dep | |
| Footer Blocksfooter-blocks | poyraz | Blocks | Free | 1 dep | |
| Glass App Shell Blockglass-app-shell-block | poyraz | Blocks | Free | 1 dep | |
| Image Cardimage-card | poyraz | Blocks | Free | no deps | |
| Mega Menu Blockmega-menu-block | poyraz | Blocks | Free | 1 dep |
