Skip to main content

Copy Button

Put text on the clipboard and say so in place, with a fallback when the browser refuses.

View as Markdown

Installation

Component API

PropTypeDefaultDescription
valuestring-The text a press puts on the clipboard.
The text a press puts on the clipboard.
copyLabelstringCopyWhat the button says, and its name to screen readers when iconOnly.
What the button says, and its name to screen readers when iconOnly.
copiedLabelstringCopiedWhat the button says once the text is on the clipboard.
What the button says once the text is on the clipboard.
failedLabelstringCannot copyWhat the button says when the browser will not copy.
What the button says when the browser will not copy.
iconOnlybooleanfalseDraws the icon alone, keeping copyLabel as the accessible name.
Draws the icon alone, keeping copyLabel as the accessible name.
fieldbooleanfalse
onCopy(value: string) => void-Called with value once it is on the clipboard.
Called with value once it is on the clipboard.
sizesm | md | lgmdHeight, padding and text size.
Height, padding and text size.
shapenone | rounded | pillrounded
disabledbooleanfalseBlocks copying and dims the button.
Blocks copying and dims the button.
animatedbooleantrue
classNamestring-
focusboolean | stringtrue