All components
Chewypixel component

Copy Button

An icon button that copies text. The copy icon pops into a check, then back.

Promo code

SWEET20

Gift card

TAFFY-7Q4M-2K9X

Installation

npx shadcn@latest add @chewypixel/copy-button

Usage

import { CopyButton } from "@/components/ui/copy-button";

export function PromoCode() {
  return (
    <div className="flex items-center gap-2">
      <code>SWEET20</code>
      <CopyButton value="SWEET20" label="Copy code" />
    </div>
  );
}

Props

value

The text to copy.

string

label

The button's accessible name. It reads "Copied" for a moment after a copy.

string

Released under the MIT License.

More components

See them in a real app

These components come from Mochi, our admin dashboard template built with Next.js, shadcn/ui and Motion.