Skip to content

Copy Button

Copies a value and proves it: the copy icon gives way to a check that draws itself in the accent, and a soft light passes once over the value.

Download
Customize

Icon only by default, with the label as its accessible name and tooltip; turn the label on and it rolls to Copied without the button changing width. The result is announced politely.

Install

npx shadcn@latest add https://obsydeui.com/r/copy-button.json

Usage

Import it from where the CLI puts it, or copy the files below by hand.

import { CopyButton } from '@/components/obsyde/ember/copy-button/CopyButton';

export function Example() {
  return (
    <CopyButton value="npm install ember" label="Copy" />
  );
}

Files

Plain React, TypeScript and CSS. No dependencies. The download keeps these paths.

  • ember/copy-button/CopyButton.tsxcomponent
  • ember/copy-button/copy-button.cssstyles
  • ember/copy-button/CopyButtonDemo.tsxdemo
  • ember/shared/accent.tsshared
  • ember/shared/spring.tsshared
  • ember/shared/ember.cssshared

API

PropTypeDefault
accentAccent'ember' | 'volt' | 'arc''ember'
valueValuestring'npm install ember'
labelLabelstring'Copy'
copiedLabelCopied labelstring'Copied'
showValueShow valuebooleantrue
showLabelShow labelbooleanfalse
resetMsReset after (ms)number1600