Componentform0.75 KB gzipZero dependencies

Add To Cart Button

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

Preview

Live Preview
Open ↗

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

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

Source code

add-to-cart-button.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxadd-to-cart-button.tsx67 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface AddToCartButtonProps extends React.HTMLAttributes<HTMLElement> {  productName: string;  onAdd: () => void;  className?: string;} export function AddToCartButton({  productName,  onAdd,  className, ...props}: AddToCartButtonProps) {  const [justAdded, setJustAdded] = React.useState(false);  const timerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { AddToCartButton } from "@/components/ui/add-to-cart-button"; <AddToCartButton />
PropTypeDescription
productNamestringConfigures product name.
onAdd() => voidCallback invoked on add.
classNamestringOptional Tailwind or custom CSS classes merged with component styles.