复制一段给 AI 编程工具的提示词,包含源码、依赖和用法
属性
ProductCardProps
同时支持以下类型的全部属性: Omit<React.ComponentProps<"div">, "title">
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| name* 必填 | string | — | — |
| price* 必填 | number | — | — |
| originalPrice | number | — | Original price, shown with a strikethrough |
| rating* 必填 | number | — | 0-5, supports halves visually by rounding |
| reviews | number | — | — |
| badge | string | — | e.g. "New" or "-20%" |
| imageClassName | string | "from-amber-300 via-orange-400 to-rose-500" | Tailwind gradient utilities for the image placeholder |
| currency | string | "$" | — |
| onAddToCart | (added: boolean) => void | — | — |
| onWishlistChange | (wished: boolean) => void | — | — |
安装
$ npx shadcn@latest add https://chromotion.dev/r/product-card.json