Copies a value and says whether it worked.
Installation
Usage
import { CopyButton } from "./ui/uicontext/components/CopyButton.ts"export const CopyInviteLink = <M>(h: Html.H<M>, link: string) => CopyButton(h, { props: { value: link, label: "Copy link", accessibleName: "Copy the invitation link" } })API reference
Props
| Name | Type | Description |
|---|---|---|
valuerequired | string | The text that goes on the clipboard. |
labelrequired | string | The button's visible text, such as "Copy". |
accessibleName | string | A fuller name for assistive technology when several copy buttons share a label: "Copy API key". |
Accessibility
- A native button; give it an
accessibleNamesuch as "Copy API key" when several copy buttons share a label. - Whether the copy worked is announced in a
statusbeside it. If the browser refuses, it says to select the text instead.