Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

clipboardjs

2,988 sites Security covered
View on drupal.org

Overview

The Clipboard.js module provides integration with the clipboard.js library, which allows non-flash based clipboard copying using the HTML5 Clipboard API.

Usage

The module provides a field formatter for email, link, string, string_long, number and slug fields.

Available are the Clipboard.js Button, the Clipboard.js Snippet, the Clipboard.js Textarea and the well-known Clipboard.js Textfield formatter.

The Clipboard.js can be added to any supported field type field by visiting the manage display page for the entity and choosing Clipboard.js as the field formatter.

Custom form fields can also use clipboard.js using the form api or in a render
array using the theme function to display the element:

$form['clipboardjs'] = [
  '#theme' => 'clipboardjs_button',
  '#value' => 'Any copyable value.',
];

Or a full example of one of the available templates e.g., clipboardjs_button,
clipboardjs_snippet, clipboardjs_textarea or clipboardjs_textfield:

$form['clipboardjs'] = [
  '#type' => 'item',
  '#theme' => 'clipboardjs_textfield',
  '#title' => $this->t('Clipboard.js Textfield'),
  '#value' => 'Any copyable value.',
  '#label' => $this->t('Click to copy'),
  '#alert_style' => 'tooltip', // e.g., 'tooltip', 'alert' or 'none'
  '#alert_text' => $this->t('Copied!'),
];

Requirements

Installation
It is assumed you are installing Drupal through Composer using the Drupal
Composer facade. See https://www.drupal.org/docs/develop/using-composer/using-composer-to-man...

It is recommended downloading third-party libraries using composer. See https://www.drupal.org/docs/develop/using-composer/manage-dependencies#t...
Follow the instructions to set up the Asset Packagist.

composer require npm-asset/clipboard:^2.0.11

πŸ‡ΊπŸ‡¦

#StandWithUkraine
Please consider supporting Ukraine in a fight for their freedom and safety of Europe.

Logo icon by Solar Icons in CC Attribution License via SVG Repo

Activity

Total releases
3
First release
Jan 2025
Latest release
1 year ago
Release cadence
1 day
Stability
33% stable

Release Timeline

Releases

Version Type Release date
2.1.0-rc1 Pre-release Jan 30, 2025
2.0.9 Stable Jan 30, 2025
2.1.x-dev Dev Jan 29, 2025