Put text on the clipboard and say so in place, with a fallback when the browser refuses.
View as MarkdownInstallation
Component API
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | - | The text a press puts on the clipboard. |
| The text a press puts on the clipboard. | |||
copyLabel | string | Copy | What the button says, and its name to screen readers when iconOnly. |
What the button says, and its name to screen readers when iconOnly. | |||
copiedLabel | string | Copied | What the button says once the text is on the clipboard. |
| What the button says once the text is on the clipboard. | |||
failedLabel | string | Cannot copy | What the button says when the browser will not copy. |
| What the button says when the browser will not copy. | |||
iconOnly | boolean | false | Draws the icon alone, keeping copyLabel as the accessible name. |
Draws the icon alone, keeping copyLabel as the accessible name. | |||
field | boolean | false | |
onCopy | (value: string) => void | - | Called with value once it is on the clipboard. |
Called with value once it is on the clipboard. | |||
size | sm | md | lg | md | Height, padding and text size. |
| Height, padding and text size. | |||
shape | none | rounded | pill | rounded | |
disabled | boolean | false | Blocks copying and dims the button. |
| Blocks copying and dims the button. | |||
animated | boolean | true | |
className | string | - | |
focus | boolean | string | true | |