# copyPermalink

> Why JS: a copy-link button writes a record's URL to the clipboard, which only script reaches.

```ts
import { copyPermalink } from "@sdxc/ui/app";
```

Writes `permalink`, resolved against the page's URL so a relative path copies as a full
address, to the clipboard on every press. A successful write sets `data-copied` on the
button and writes `copiedLabel` into its `[role="status"]` element for two seconds.

## Signature

```ts
copyPermalink(permalink: string, copiedLabel: string): MixinDescriptor<HTMLButtonElement>
```

Returns: A mixin descriptor for the button's `mix` prop.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `permalink` | `string` | The record's URL, absolute or relative to the page. |
| `copiedLabel` | `string` | What a screen reader announces once the link is copied. |

## Examples

```tsx
<button type="button" mix={[copyPermalink("/monitors/42", t("linkCopied"))]}>
	<LinkIcon /><span role="status" mix={[visuallyHidden()]} />
</button>
```
