Copy Button

Copies a value and says whether it worked.

Webhook URL
https://hooks.northpeak.example/in/7f3a9c
Workspace ID
ws_01HZK4M8Q2

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/copy-button

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

CopyButton props
NameTypeDescription
valuerequiredstringThe text that goes on the clipboard.
labelrequiredstringThe button's visible text, such as "Copy".
accessibleNamestringA fuller name for assistive technology when several copy buttons share a label: "Copy API key".

Accessibility

  • A native button; give it an accessibleName such as "Copy API key" when several copy buttons share a label.
  • Whether the copy worked is announced in a status beside it. If the browser refuses, it says to select the text instead.

Source