Skip to content
synccn

Copy Button

Copies text and confirms with an animated check.

npx shadcn@latest add @synccn/button
sync_demo_7Q••••••••

Installation

$ pnpm dlx shadcn@latest add @synccn/copy-button

First time in this project? Connect synccn with one command.

Usage

import { CopyButton } from "@/components/ui/copy-button";<CopyButton value="npx shadcn@latest add @synccn/button" />

API reference

Generated from the component's TypeScript types, so it always matches the code.

CopyButton

Copies `value` and swaps to a check mark for a moment.

  • valuerequired
    string | (() => string)

    Text to copy, or a function that returns it.

  • label
    string

    Default "Copy"

    Accessible label before copying.

  • onCopied
    () => void

    Called after a successful copy.

  • className
    string

    Extra classes for the root element.

  • children
    React.ReactNode

    Content to render.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Helpers

npm packages

Accessibility

From the source

Read from this component's code when the site builds, so it can't drift.

  • ARIA attributes: aria-label
  • Shows a visible focus ring for keyboard users