Copy button with confirmation in WordPress
A button that copies an IBAN, a reference, an address or a promo code and confirms "Copied", on screen and to screen readers.
Here is an excerpt of this component's code in WordPress. The full code is free for members, ready to copy into your project.
This component also comes in
The code in WordPress
<?php
/**
* Plugin Name: Forge, Bouton copier avec confirmation
* Description: Un bouton qui copie un IBAN, une référence, une adresse ou un code promo et confirme « Copié », à l'écran comme au lecteur d'écran. Ajoute la composition « Bouton copier avec confirmation » à l'éditeur de blocs.
* Version: 1.0.0
* Requires at least: 6.6
* Requires PHP: 8.1
* Author: Forge
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: forge-bouton-copier-presse-papiers
*<!-- wp:html -->
<section class="cpp" aria-labelledby="cpp-titre" data-cpp>
<header class="cpp__head">
<p class="cpp__eyebrow">Commande n° BDL-24817</p>
<h2 class="cpp__title" id="cpp-titre">Réglez votre commande par virement</h2>
<p class="cpp__intro">Copiez ces informations dans votre application bancaire. Votre colis part dès réception du virement, en général sous deux jours ouvrés.</p>
</header>
<dl class="cpp__list">
<div class="cpp__row">
<dt class="cpp__label">IBAN</dt>
<dd class="cpp__value">
<span class="cpp__code" id="cpp-iban" data-cpp-value="FR7630006000011234567890189">FR76 3000 6000 0112 3456 7890 189</span>(() => {
if (!document.querySelector(".cpp")) return;
document.querySelectorAll("[data-cpp]").forEach((root) => {
const status = root.querySelector("[data-cpp-status]");
let reset = 0;
let announcing = 0;
function announce(message) {
status.textContent = "";
clearTimeout(announcing);
// Emptying the region first makes screen readers repeat a message identical to the previous one.
announcing = setTimeout(() => {:root {
--cpp-bg: #ffffff;
--cpp-text: #172033;
--cpp-muted: #4a5568;
--cpp-line: #d9dee7;
--cpp-accent: #1d4ed8;
--cpp-shadow: 0 1px 2px rgb(15 23 42 / 0.06), 0 8px 24px rgb(15 23 42 / 0.06);
--cpp-btn-bg: #1d4ed8;
--cpp-btn-hover: #1e40af;
--cpp-btn-text: #ffffff;
--cpp-done-bg: #166534;
--cpp-done-text: #ffffff;Free component: copy it freely, including for commercial projects.
Other buttons components in WordPress
Buttons components in WordPress
A row of buttons to share the page on Facebook, LinkedIn, WhatsApp or by email, with a copy-link button and no third-party script.
- Tailwind
- React
- CSS
- WordPress

Toggle heart buttons that count favourites, remember them between visits and announce them to screen readers.
- Tailwind
- React
- CSS
- WordPress

A button that adds an event to Google Calendar, Outlook or any calendar through an .ics file, with no third-party service.
- Tailwind
- React
- CSS
- WordPress

A WhatsApp button pinned to the bottom of the screen that opens a welcome bubble with common topics and a pre-filled message, with no third-party widget.
- Tailwind
- React
- CSS
- WordPress

A bar pinned to the bottom of mobile screens with Call and Directions buttons and a live open-now status, built for trades and local shops.
- Tailwind
- React
- CSS
- WordPress

Circular icon buttons with an accessible tooltip on hover and focus.
- Tailwind
- React
- CSS
- WordPress