Skip to content
Data Display

CopyButton

A square outline icon button that copies a value. It sits beside what it copies, a link or an address, which stays whatever it was. For two seconds after a copy its icon is a check and its name is Copied. Where the value should read as something to paste, CopyField draws it in a box instead.

Import

import { CopyButton } from "@mikenotthepope/substrateui"

Labels

The button draws no text, so label is its whole name. After a copy the name is copied for two seconds, then label again. A refused clipboard changes nothing. Override one instance with the labels prop, or every instance through LabelsProvider's copyButton key.

PropTypeDefaultDescription
copiedstring"Copied"The button's name for two seconds after a copy.

API Reference

PropTypeDefaultDescription
valuestring | null—The text copied. null disables the button.
labelstring—Accessible name, naming what it copies ("Copy apply link"). Nothing is drawn from it.
labels{ copied?: string }—Translatable strings. Resolves through the LabelsProvider (copyButton) before falling back to English defaults.
size"icon" | "icon-sm""icon"The square's size. icon-sm sits beside a size="sm" control.
variantButton variant"outline"Any Button variant; outline is the one it is drawn for.