---
name: "setClipboardData"
mode: "kit"
versionRequirements:
  - { name: "BaseKit", version: "2.0.1" }
platform:
  - "iOS"
  - "Android"
async: true
---

## setClipboardData

> [VERSION] BaseKit >= 2.0.1

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

Set the system clipboard content

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `isSensitive` | `boolean` | No | `false` | `3.2.0` | Whether the content is sensitive true means sensitive; false means not sensitive; default is non-sensitive If set to sensitive, Android 13 and above can prevent the content from appearing in the copy visual confirmation preview Note: This property applies only to devices running Android 13 or higher |
| `data` | `string` | Yes | - | `2.0.1` | Clipboard content |
| `complete` | `() => void` | No | - | - | Completion callback (executed on both success and failure) |
| `success` | `() => void` | No | - | - | Success callback |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Failure callback |

#### fail callback parameters

| Property | Type | Description |
| --- | --- | --- |
| `errorMsg` | `string` | Error message |
| `errorCode` | `string \| number` | Error code |
| `innerError` | `Object` | Error extension |

##### fail(params).innerError properties

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Extended error code |
| `errorMsg` | `string` | Extended error information |


### Examples

```tsx
// Set system clipboard content (isSensitive flags sensitive information; effective on Android 13+ only)
ty.setClipboardData({
  data: "Hello Tuya",
  isSensitive: false,
  success: () => console.log("Written to clipboard"),
  fail: error => console.error(error),
});
```
