React Native Mantine › Buttons
CopyButton
Copy text to clipboard
Import: import { CopyButton } from 'react-native-mantine';
Usage
import { CopyButton, Button } from 'react-native-mantine';
<CopyButton value="Text to copy" timeout={2000}>
{({ copied, copy }) => (
<Button
onPress={copy}
color={copied ? 'green' : 'blue'}
>
{copied ? 'Copied!' : 'Copy'}
</Button>
)}
</CopyButton>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value (required) | string | Value to copy to clipboard when copy function is called | |
timeout | number | 1000 | Copied state timeout in milliseconds - how long the copied state persists |
children (required) | (payload: { copied: boolean; copy: () => void }) => React.ReactNode | Function that returns JSX based on current state - receives copied state and copy function |