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.
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.jsonUsage
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.tsxcomponentember/copy-button/copy-button.cssstylesember/copy-button/CopyButtonDemo.tsxdemoember/shared/accent.tssharedember/shared/spring.tssharedember/shared/ember.cssshared
API
| Prop | Type | Default |
|---|---|---|
accentAccent | 'ember' | 'volt' | 'arc' | 'ember' |
valueValue | string | 'npm install ember' |
labelLabel | string | 'Copy' |
copiedLabelCopied label | string | 'Copied' |
showValueShow value | boolean | true |
showLabelShow label | boolean | false |
resetMsReset after (ms) | number | 1600 |