"use client";
import { ClipboardButton } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
value (required) | string | — | Current value (controlled); null where it means "nothing selected". |
resetDelayMs | false | number | 2000 | Back to the copy label after this many ms (default 2000); false keeps it. |
size | ButtonSize | sm | Size from the shared scale (xs, sm, md, lg). |
tone | ButtonTone | neutral | Colour role (neutral, primary, danger, success, warning, info). |
variant | ButtonVariant | outline | Emphasis (solid, secondary, soft, outline, ghost). |
copiedLabel | ReactNode | "Copied" | Label after a successful copy (default "Copied"). |
failedLabel | ReactNode | "Copy failed" | Label after a failed copy (default "Copy failed"). |
icon | ReactNode | boolean | — | Leading icon: true shows a copy icon (a check once copied); any node replaces it. With iconOnly the label becomes the accessible name. |
iconOnly | boolean | — | Icon-only button; the (copied) label stays as its accessible name. |
label | ReactNode | Copy | Visible label (also the accessible name). |
onAction | () => void | — | Called with the id of the activated command or option. |
onCopy | (copied: boolean) => void | — | Called with false when the clipboard could not be written. |
valuerequiredstring
Current value (controlled); null where it means "nothing selected".
resetDelayMsdefault 2000false | number
Back to the copy label after this many ms (default 2000); false keeps it.
sizedefault smButtonSize
Size from the shared scale (xs, sm, md, lg).
tonedefault neutralButtonTone
Colour role (neutral, primary, danger, success, warning, info).
variantdefault outlineButtonVariant
Emphasis (solid, secondary, soft, outline, ghost).
copiedLabeldefault "Copied"ReactNode
Label after a successful copy (default "Copied").
failedLabeldefault "Copy failed"ReactNode
Label after a failed copy (default "Copy failed").
iconReactNode | boolean
Leading icon: true shows a copy icon (a check once copied); any node replaces it. With iconOnly the label becomes the accessible name.
iconOnlyboolean
Icon-only button; the (copied) label stays as its accessible name.
labeldefault CopyReactNode
Visible label (also the accessible name).
onAction() => void
Called with the id of the activated command or option.
onCopy(copied: boolean) => void
Called with false when the clipboard could not be written.
Other props are passed to the root element (ButtonHTMLAttributes<HTMLButtonElement>), including className, style, id and aria-* attributes.
Complex object props use fixed fixtures. Primitive props stay editable.
<ClipboardButton value="pnpm add @pixxl-tools/components" variant="outline" tone="neutral" size="sm" /><ClipboardButton icon tone="primary" variant="solid" resetDelayMs={1800} value="pixxl" /><ClipboardButton value="pnpm add @pixxl-tools/components" variant="outline" tone="neutral" size="sm" />