Early Access

Usage

npm install @carabine/ui
pnpm add @carabine/ui
yarn add @carabine/ui
npm i @carabine/ui

Inside CodePreview

CodePreview.CopyButton is now powered by CopyButton internally — the same animation, zero duplication.

npm install @carabine/ui

API Reference

PropTypeDefaultDescription
value*stringText written to the clipboard on click.
durationnumber2000How long (ms) to show the "copied" checkmark before reverting.
onCopy(value: string) => voidCallback fired after a successful copy, receives the copied value.
unstyledbooleanfalseStrip all default styles — no data-cui-* attributes attached.

CSS states

/* Idle — default ghost button */
[data-cui-copy-button][data-state='idle'] { }

/* Copied — green tint for 2 s */
[data-cui-copy-button][data-state='copied'] { }

/* Override the size */
[data-cui-copy-button] {
  --cb-size: 28px;
  --cb-radius: 5px;
}