---
title: useCopy
description: Copies text to the clipboard and confirms it with a toast.
---

```tsx
const copy = useCopy();

copy(span.spanId, { title: t`Span ID copied`, description: span.spanId });
```

- Use it for copy buttons on IDs, URLs and snippets.
- Needs a `Toast.Provider` above it; the confirmation goes through `toastManager`.
- The title says what was copied. The description repeats a short value, or says what to do with a long one ("Paste it to share this trace.").

## API

| Prop | Type | Default | Description |
| - | - | - | - |
| `text` | `string` | - | First argument. The text to copy. |
| `title` | `string` | - | On the second argument. Toast title. |
| `description` | `string` | - | On the second argument. Toast description. |

`useCopy()` returns `copy(text, { title, description })`. Built on [Toast](/deft/components/toast).
