Skip to content

Internal ID software / Tools

CopyButton

Copies a text to the clipboard and says whether it worked.

Not drawn in Figma: built only from the tokens, for internal ID software. In code: components/software/tools.tsx. From the old system: CopyLinkButton in @id-identity-as/ui.

Example

import { CopyButton } from '@/components/software/tools';

<CopyButton value={url} copiedLabel="Kopieret" failedLabel="Kunne ikke kopiere">Kopiér link</CopyButton>

Props

PropTypeDefaultWhat it does
value (required)stringThe text that is copied, such as a link.
copiedLabel (required)stringWhat the button says once the text is copied.
failedLabel (required)stringWhat the button says when the browser refuses.
children (required)ReactNodeThe label of the button.

Do

  • Say what is copied in the label: "Kopiér link".
  • Show the text that is copied nearby, so it can also be selected by hand.

Do not

  • Do not copy without a press.
  • Do not hide a failure. A copy that did not happen says so.

Accessibility

  • The outcome is announced politely to a screen reader.
  • It is the outline Button, so the keyboard works as on any button.

Tokens it uses

  • color.button.outline.stroke
  • color.button.outline.text
  • radius.sm
  • type.button.md