bigbullui logobigbullui
Componentform

Add To Cart Button

Add-to-cart button with flying dot arc and check stamp.

Preview

Live Preview
Premium Headphones
25%

Premium Headphones

$299$399

Jordan Daisy

Product Designer

AvailableRemote
The Future of Design Systems

The Future of Design Systems

Alex Rivera8 min read
Oc
t 14

Tech Conference 2026

21:00
Berlin Arena
Invoice #INV-2026-0987draft
Date: 2026-09-15Due: 2026-10-15
ItemQtyPrice
Design Services1$150
Development Hours5$100
SubtotalNaN
Tax (10%)NaN
TotalNaN
THERMAL RECEIPT#0WBAPO
Design Consultation$150
Development Hours$200
Total$385.00
Thank you for your purchase!
Premium Headphones
1
Phone Case
2
Subtotal$377.00
Tax$30.16
Total$407.16
Color
Size
Order #102938Processing
Design Services1x
Development5x
VIP

LOYALTY TIER

$100

Jordan Daisy

Happy Birthday!

J

Jordan Daisy

Product Designer

UX

Badge: EMP-8942

Wedding Reception

Please confirm your attendance

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add add-to-cart-button

Or install the full npm package:

npm install bigbullui

Usage

import { AddToCartButton } from "@/components/ui/add-to-cart-button";

<AddToCartButton />

Source code

add-to-cart-button.tsx

Zero dependencies (only React + utils). Copy and paste directly into your project:

"use client";

import * as React from "react";
import { cn } from "./lib/utils";

export interface AddToCartButtonProps {
  productName: string;
  onAdd: () => void;
  className?: string;
}

const FlyingDot = "add-to-cart-flying-dot";
const ScaleIn = "add-to-cart-scale-in";

export function AddToCartButton({
  productName,
  onAdd,
  className,
}: AddToCartButtonProps) {
  const [justAdded, setJustAdded] = React.useState(false);

  const handleClick = () => {
    onAdd();
    setJustAdded(true);
    const timer = setTimeout(() => setJustAdded(false), 1500);
    return () => clearTimeout(timer);
  };

  return (
    <>
    <button
      onClick={handleClick}
      className={cn(
        "inline-flex cursor-pointer items-center justify-center rounded-md bg-accent text-accent-foreground px-4 py-2 text-sm font-semibold uppercase tracking-widest hover:bg-accent/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent transition-colors duration-150 motion-reduce:transition-none motion-reduce:focus-visible:ring-0",
        ScaleIn
      )}
    >
      <svg
        width="1em"
        height="1em"
        viewBox="0 0 24 24"
        fill="currentColor"
        aria-hidden="true"
        className={cn("transition-transform duration-200")}
      >
        <path d="M19 9h-4A2 2 0 0 0 13 11v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-4M9 7h6v2H9zm5 4h-2v2h2v-2zm-2-6h2v4H7v-4zm6 6h-4v2h4v-2z" />
      </svg>
      Add to Cart
    </button>

    {/* Flying dot animation */}
    {justAdded && (
      <div
        className={cn(
          "absolute -inset-0 pointer-events-none overflow-hidden",
          FlyingDot
        )}
      >
        <div
          className={cn(
            "absolute size-3 rounded-full bg-accent",
            "animate-flying-dot"
          )}
        />
      </div>
    )}
    </>
  );
}

Props

PropTypeDescription
productNamestringProduct name shown in the confirmation (required).
onAdd() => voidCallback fired when the item is added (required).