Componentform0.75 KB gzipZero dependencies
Add To Cart Button
Add-to-cart button with flying dot arc and check stamp.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add add-to-cart-buttonOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { AddToCartButton } from "@/components/ui/add-to-cart-button"; <AddToCartButton />Source code
add-to-cart-button.tsx + 1 helperZero 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 />| Prop | Type | Description |
|---|---|---|
| productName | string | Configures product name. |
| onAdd | () => void | Callback invoked on add. |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |