React Native · Components
CopyButton
Button that copies a value to the clipboard: when pressed the icon briefly becomes ✓ and "Copied" is read to the screen reader.
2 exports
Live example
The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.
Preview
sk_live_51H…a9XqCode
Events
- Events appear here when you interact with the preview.
Value from the server (a function; loading while waiting)
Import
CopyButton
componentButton that copies a value to the clipboard: when pressed the icon briefly becomes ✓ and "Copied" is read to the screen reader. Its variant and size are the same as Button; without text an IconButton is drawn.
For your own button see useClipboard.
Examples
CopyButtonProps
interfaceProps of the CopyButton component (same names as on web).
Extends: Omit<ButtonProps, "children" | "icon" | "onPress" | "accessibilityLabel">
| Name | Type | Default | Description |
|---|---|---|---|
value | ClipboardValue | (() => ClipboardValue | Promise<ClipboardValue>) | Value to copy: text, rich content ({ text, html }; on mobile text is copied) or a function returning the value (may be a Promise; e.g. a share link from the server). The function is only called when pressed. | |
children? | ReactNode | Button text. When given, a text button is drawn and copiedLabel shows after copying; otherwise an icon-only square button (its name is still label, shown as a tooltip on long press). | |
label? | string | {@link UIProvider} `copy` text ("Kopyala") | Button name. |
copiedLabel? | string | copied` text ("Kopyalandı") | Name shown after copying. |
timeout? | number | 2000 | Duration of the "copied" state (ms). |
sensitive? | boolean | Sensitive data (password, code): hidden in previews, not shared across devices. | |
onCopy? | (text: string) => void | Called with the copied text when copying succeeds. | |
onError? | (error: unknown) => void | Called when copying fails. |