Skip to Content
Kokonut UI

BT-16ButtonsNew, October 21, 2026

Cart Button

An Add button that opens into a quantity stepper in place, with a bin at one and press-and-hold to repeat.

Install with
lucide-react, motion

PROSelling products? Product Options Form is in Kokonut UI Pro

Installation

Cart Button is a free, open-source React component in the Kokonut UI Buttons collection. Add it with the shadcn CLI, which copies the source into components/kokonutui/cart-button.tsx, so the code is yours to change.

npx shadcn@latest add @kokonutui/cart-button

Or add it by hand: install its packages, then copy the source from Copy code above into components/kokonutui/cart-button.tsx.

npm install lucide-react motion

Usage

import CartButton from "@/components/kokonutui/cart-button";

export default function Example() {
  return <CartButton />;
}

Props

items
CartItem[]Default built-in
defaultQuantities
Record<string, number>Default { croissant: 2 }

Starting quantities, by item id.

currency
stringDefault "$"
onCheckout
(quantities: Record<string, number>) => void
className
string

Extra classes for the root element.

CartItem

idrequired
string
namerequired
string
detailrequired
string

Pack size or weight, shown under the name.

pricerequired
number
iconrequired
LucideIcon
tintrequired
string

Tailwind classes for the icon tile.

max
number

Dependencies

NeedsVersionComes from
lucide-react^0.556.0npm, installed by the CLI
motion^12.23.25npm, installed by the CLI
cn from lib/utils.tsshadcn init
React19Your app
Tailwind CSS4Your app

No provider, font or global CSS to set up: the file works as soon as it lands.