Skip to main content
The CopyButton component provides a one-click solution for copying text to the clipboard. It shows visual feedback when text is successfully copied.

Usage

With code snippet

Custom timeout

Disable icon reset

API reference

CopyButton

Extends all props from IconButton.
string
required
The text to copy to clipboard when the button is clicked.
number
default:"1000"
Time in milliseconds before the icon resets to the copy icon after successful copy.
boolean
default:"true"
Whether to reset the icon back to the copy icon after the timeout. If false, the success icon persists.
1 | 2 | 3 | 4
default:"2"
The size of the button.
string
Accessible label for the button. Recommended for accessibility.
string
Additional CSS class for the button.
(event: MouseEvent) => void
Click handler. The copy action is handled automatically.