“Add to calendar” button in WordPress
A button that adds an event to Google Calendar, Outlook or any calendar through an .ics file, with no third-party service.
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 « Ajouter à mon agenda »
* Description: Un bouton qui ajoute un événement à Google Agenda, à Outlook ou à n’importe quel agenda grâce à un fichier .ics, sans service tiers. Ajoute la composition « Bouton « Ajouter à mon agenda » » à 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-ajout-agenda
*<!-- wp:html -->
<article class="baa" data-baa aria-labelledby="baa-titre">
<p class="baa-date"><time datetime="2026-11-21T15:00">Samedi 21 novembre 2026 · 15 h – 17 h</time></p>
<h2 class="baa-title" id="baa-titre">Atelier dégustation : vins de Loire</h2>
<p class="baa-place">Cave des Tanneurs, 8 rue des Tanneurs, 37000 Tours</p>
<p class="baa-text">Six vins commentés par Hélène Morin, caviste. Réservation confirmée par e-mail.</p>
<details class="baa-menu" data-baa-menu>
<summary class="baa-button">
<svg class="baa-icon" viewBox="0 0 24 24" width="20" height="20" aria-hidden="true"><path d="M7 3v3M17 3v3M4 9h16M5 5h14a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z"/></svg>
Ajouter à mon agenda
</summary>
<ul class="baa-list">(() => {
if (!document.querySelector(".baa")) return;
document.querySelectorAll("[data-baa]").forEach((root) => {
const on = (el, type, fn) => el.addEventListener(type, fn);
const menu = root.querySelector("[data-baa-menu]");
on(document, "keydown", (event) => {
if (event.key !== "Escape" || !menu.open) return;
menu.open = false;
menu.querySelector("summary").focus();
});
on(document, "click", (event) => {
if (menu.open && !menu.contains(event.target)) menu.open = false;:root {
--baa-card: #ffffff;
--baa-text: #2a1a24;
--baa-muted: #5c4a55;
--baa-line: #eadde4;
--baa-accent: #831843;
--baa-accent-text: #ffffff;
--baa-hover: #fdf2f8;
--demo-bouton-ajout-agenda-bg: #f6eff3;
--demo-bouton-ajout-agenda-text: #2a1a24;
}
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 copies an IBAN, a reference, an address or a promo code and confirms "Copied", on screen and to screen readers.
- 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