File size: 1,281 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
title: Clipboard
description: Used to copy text to the clipboard
links:
  source: components/clipboard
  storybook: components-clipboard--basic
  recipe: clipboard
  ark: https://ark-ui.com/react/docs/components/clipboard
---

<ExampleTabs name="clipboard-basic" />

## Usage

```tsx
import { Clipboard } from "@chakra-ui/react"
```

```tsx
<Clipboard.Root>
  <Clipboard.Trigger>
    <Clipboard.CopyText />
    <Clipboard.Indicator />
  </Clipboard.Trigger>
  <Clipboard.Input />
</Clipboard.Root>
```

## Examples

### Button

Use the `Clipboard.Trigger` component to create a copy button.

<ExampleTabs name="clipboard-with-button" />

### Input

Use the `Clipboard.Input` component to create a copy input.

<ExampleTabs name="clipboard-with-input" />

### Timeout

Use the `timeout` prop to change the duration of the copy message.

<ExampleTabs name="clipboard-with-timeout" />

### Link Appearance

Here's an example that combines the `Clipboard.Trigger` and
`Clipboard.ValueText` components to create a link appearance.

<ExampleTabs name="clipboard-with-link" />

### Store

Alternatively, you can use the `useClipboard` hook to create a custom component.

<ExampleTabs name="clipboard-with-store" />

## Props

### Root

<PropTable component="Clipboard" part="Root" />