copy to clipboard docs

Copy To Clipboard

A function to copy a string to the clipboard.

Twig Usage
{% include '@bolt-components-copy-to-clipboard/copy-to-clipboard.twig' with {
  text_to_copy: ''
} only %}
Note: when assigning component props as HTML attributes on a web component, make sure to use kebab-case.
Prop Name Description Type Default Value Option(s)

A Drupal-style attributes object with extra attributes to append to this component.


Text to use for the inital copy button. Ignored if the custom_trigger property is used.

string Copy Link
text_to_copy *

The text to copy to the clipboard.


(optional) Custom content to show for the initial copy trigger. If you pass a link, set the URL to '#!' since it should not being followed.

string , object , array

(optional) Custom content to show while copy is in progress. This content will be rotated while the copying happens, so it's recommended to pass an icon.

string , object , array

(optional) Custom content to show after a successful copy.

string , object , array
Install Install
npm install @bolt/components-copy-to-clipboard
Dependencies @bolt/core @bolt/elements-icon @bolt/lazy-queue clipboard

copy to clipboard

Custom transition
Custom transition

Custom confirmation