Wishlist Button

A Tailwind heart icon button for product cards that toggles a wishlist state. It sets aria-pressed and switches its label between add and remove.

src/registry/ui/wishlist-button.tsx/r/wishlist-button.json

Installation#

bash
npx shadcn@latest add @minidev/wishlist-button

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/wishlist-button.json

Usage#

tsx
import { WishlistButton } from "@/components/ui/wishlist-button"

export function Example() {
  return (
    <WishlistButton active={wish} onToggle={() => setWish((w) => !w)} />
  )
}

API reference#

WishlistButton props
PropTypeDefault
activeboolean-
onToggle() => void-
classNamestring-

Dependencies#

npm

lucide-react

Built from

Examples#

All e-commerce components

Learn more