# copy_text_with_feedback

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/clipboard/copy_text_with_feedback)

Copy text to the clipboard and surface the outcome as a toast.

Centralizes the copy-then-notify pattern shared by the Ctrl+C and
`[ COPY ]` paths so the success/failure messaging stays consistent.

## Signature

```python
copy_text_with_feedback(
    app: App,
    text: str,
    *,
    failure_noun: Literal['input', 'selection'],
    success_message: str | None = None,
) -> bool
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `app` | `App` | Yes | The active Textual app, used for the clipboard backend and toasts. |
| `text` | `str` | Yes | Text to copy. |
| `failure_noun` | `Literal['input', 'selection']` | Yes | Noun used in the warning toast (e.g. `"input"`, `"selection"`). |
| `success_message` | `str \| None` | No | Toast shown on success. When `None`, success is silent (used by the selection-copy path, which has no visible draft to confirm). (default: `None`) |

## Returns

`bool`

`True` when the copy succeeded.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/7794b61a6e76230e8c7a49bdce808b3728305914/libs/code/deepagents_code/clipboard.py#L103)