Pass the text in value, or use getValue for text from the server. Give an icon-only button a label that names the value.
api-key-row.tsx
CopyButton
<button>| Prop | Type | Default | Description | ||||
|---|---|---|---|---|---|---|---|
| aria-label | string | — | Defines a string value that labels the current element. The name of the button. An icon-only button defaults to "Copy"; one with text uses its text. | ||||
| class | string | — | |||||
| busy | boolean | false | The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading. | ||||
| spinner | "center""start" | "start" | center (default): the spinner covers the label. start: it takes the leading icon slot. The icon sizes always use center, because their one icon is the label. | ||||
| glass | "clear""dark""light" | — | |||||
| rounded | "default""full" | — | |||||
| size | "default""icon""icon-lg""icon-sm""icon-xs""lg""sm""xl""xs" | — | |||||
| variant | "dashed""default""destructive""destructive-outline""ghost""link""media""outline""secondary" | "ghost" | |||||
| value | string | — | The text to copy. An empty value with no getValue disables the button. | ||||
| get | — | Gets the text at press time: a value that is costly to build, or that comes from the server (a new token). While its promise runs, the button shows the Button spinner (pending). | |||||
| timeout | number | 2000 | How long the result (check or X) shows, in ms. Default 2000. | ||||
| on | — | Runs after the clipboard has the text, with the text. | |||||
| on | — | Runs when the copy fails: no Clipboard API, the browser refused, or getValue failed. | |||||
From Base UIButtonBase UI docs | |||||||
| focusable | boolean | false | Whether the button should be focusable when disabled. | ||||
| render | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render. | |||||
| style | — | Style applied to the element, or a function that returns a style object based on the component's state. | |||||
| |||||||
| ...props | <button> attributes | — | Every other attribute goes to the <button>, with a ref. | ||||
AnimatedCopyIcon
<svg>| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "bulk""duotone""solid""stroke""twotone" | — | stroke (default): 1.5 strokes. solid: the body filled, inner details cut through. duotone: a 40% fill under the stroke. twotone: the details at 40%. bulk: the body filled at 40% with no outline, the details at full color. |
| corners | "round""sharp" | — | round (default): round caps and joins, soft corners. sharp: square caps, miter joins. |
| trigger | "hover""none" | — | hover (default) plays once per hover or keyboard focus of the control around the icon. |
| play | number | — | Plays once each time this number changes (a new notice, a saved form). |
| state | "copied""error""idle" | "idle" | copied draws a bare check, error a bare cross with a wobble. Default idle. |
| status | boolean | false | Status colors for the marks: the check takes the success color and the cross the destructive color (the -soft-foreground tokens). Default false: both take the text color. |
| ...props | <svg> attributes | — | Every other attribute goes to the <svg>, with a ref. |
| Enter | Copies the value. |
|---|---|
| Space | Copies the value. |
Built with
Installs with Copy Button
- Components
- Button
- Parts
- Animated Copy Icon



