Skip to main content

Copy button

shadow

The Copy button allows you to copy the desired content to the clipboard with one click. Supported elements are input, textarea, wje-input, wje-label and a element.

Basic usage

Custom label

Adding the label and label-success properties will change the tooltip text after copying the value.

Element

Input

WJE-Input

When to use

Use wje-copy-button when users need to enter values, choose options, or trigger form-related actions.

When not to use

Do not use it as a decorative element without interaction. Prefer presentational components in that case.

Accessibility

Always provide a label (label/aria-label), keep keyboard support, and surface clear validation feedback.

Best Practices

  • Keep validation rules and error behavior consistent across the entire form.
  • Show loading or disabled states during async operations.
  • Split complex forms into smaller sections with immediate feedback.

Attributes and Properties

for

DescriptionThe id of the element to copy content from.
Attributefor
Typestring
Default-

value

DescriptionThe text to be copied.
Attributevalue
Typestring
Default-

Events

NameDescription
wje-copy-button:clickEmitted when the component is clicked.

Methods

copy

DescriptionCopies the specified text or node.
Signature(button: HTMLElement) => void

copyTarget

DescriptionCopies the target content.
Signature(content: HTMLElement) => Promise

CSS Shadow Parts

NameDescription
buttonStyles the button element.

CSS Custom Properties

NameDescription
--text-colorControls the color of the text.
--background-colorControls the background color of the button.

Slots

NameDescription
defaultThis is a default/unnamed slot.