# Clipboard Helpers

Source code is hosted on [GitHub](https://github.com/corets/clipboard-helpers)

{% tabs %}
{% tab title="yarn" %}

```bash
yarn add @corets/clipboard-helpers
```

{% endtab %}

{% tab title="npm" %}

```
npm install --save @corets/clipboard-helpers
```

{% endtab %}
{% endtabs %}

## copyToClipboard() <a href="#copytoclipboard" id="copytoclipboard"></a>

Copy a value to clipboard:

```typescript
import { copyToClipboard } from "@corets/clipboard-helpers"

copyToClipboard("some value")
```

Behind the scenes, a hidden input element is rendered to perform the copy action. Sometimes you might want to specify a custom render target, for example when using a focus trap:

```typescript
import { copyToClipboard } from "@corets/clipboard-helpers"

copyToClipboard("some value", "#target")
// or
copyToClipboard("some value", document.getElementById("target"))
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.corets.io/helpers/clipboard-helpers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
