Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Clipboard.js

2,121 sites Security covered Drupal 8–10 · not 11
View on drupal.org

This module integrates the clipboard.js library to enable non-flash based copying of text to the clipboard using the HTML5 Clipboard API. It provides field formatters for various field types and allows custom form fields to utilize clipboard.js functionality.

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

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Jan 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 3
Maintenance
Dormant

Release Timeline

Releases

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