copyPermalink
Why JS: a copy-link button writes a record's URL to the clipboard, which only script reaches.
import { copyPermalink } from "@sdxc/ui/app";Usage
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
copyPermalink(permalink: string, copiedLabel: string): MixinDescriptor<HTMLButtonElement>Returns a mixin descriptor for the button's mix prop.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
permalink | string | Yes | The record's URL, absolute or relative to the page. |
copiedLabel | string | Yes | What a screen reader announces once the link is copied. |
Examples
<button type="button" mix={[copyPermalink("/monitors/42", t("linkCopied"))]}>
<LinkIcon /><span role="status" mix={[visuallyHidden()]} />
</button>