PXD

Copy Button

A button that copies a given string to the clipboard and provides feedback when copied.

Default

CopyButton extends the Button component.

<template>
  <PCopyButton text="lorem" icon />
</template>

Variant

<template>
  <PStack>
    <PCopyButton icon text="lorem" variant="default" />
    <PCopyButton icon text="lorem" variant="primary" />
    <PCopyButton icon text="lorem" variant="success" />
    <PCopyButton icon text="lorem" variant="warning" />
    <PCopyButton icon text="lorem" variant="error" />
    <PCopyButton icon text="lorem" variant="ghost" />
  </PStack>
</template>

With label

<template>
  <PCopyButton text="lorem" variant="default">
    <span>
      Click to copy
    </span>
  </PCopyButton>
</template>

Props

NameTypeDefaultDescription
textstring | null-Text to copy to the clipboard

Events

NameTypeDescription
copy(text: string | null | undefined, event: PointerEvent) => voidEmitted when the copy action is triggered.

Source

Source