Accessible date picker in WordPress
A date-picking calendar fully usable with the keyboard, with closed days, a minimum lead time and checked manual entry.
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
<!-- wp:html -->
<form class="sdc" data-sdc data-sdc-closed="0,1" data-sdc-lead="2" data-sdc-day-class="sdc-day" novalidate aria-labelledby="sdc-titre">
<h2 class="sdc-title" id="sdc-titre">Commander un gâteau</h2>
<p class="sdc-intro">Retrait en boutique du mardi au samedi, à partir de 48 h après la commande.</p>
<div class="sdc-field">
<label class="sdc-label" for="sdc-date">Date de retrait</label>
<div class="sdc-row">
<input class="sdc-input" id="sdc-date" name="retrait" type="text" inputmode="numeric" autocomplete="off" placeholder="jj/mm/aaaa" aria-describedby="sdc-aide">
<button class="sdc-toggle" type="button" aria-expanded="false" aria-controls="sdc-calendrier" data-sdc-toggle hidden>
<svg class="sdc-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>
<span class="sdc-sr">Choisir une date dans le calendrier</span>
</button>(() => {
if (!document.querySelector(".sdc")) return;
document.querySelectorAll("[data-sdc]").forEach((root) => {
const on = (el, type, fn) => el.addEventListener(type, fn);
const form = root;
const input = form.querySelector("#sdc-date");
const toggle = form.querySelector("[data-sdc-toggle]");
const pop = form.querySelector("[data-sdc-pop]");
const days = form.querySelector("[data-sdc-days]");
const help = form.querySelector("[data-sdc-help]");
const status = form.querySelector("[data-sdc-status]");
const closed = (form.dataset.sdcClosed ?? "").split(",").filter(Boolean).map(Number);<?php
/**
* Plugin Name: Forge, Sélecteur de date accessible
* Description: Un calendrier de choix de date utilisable entièrement au clavier, avec jours fermés, délai minimum et saisie manuelle vérifiée. Ajoute la composition « Sélecteur de date accessible » à 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-selecteur-date-calendrier
*:root {
--sdc-card: #ffffff;
--sdc-text: #1d2433;
--sdc-muted: #4b5263;
--sdc-off: #8a8f9c;
--sdc-line: #cdd1db;
--sdc-field: #ffffff;
--sdc-hover: #f1ecfb;
--sdc-accent: #5b21b6;
--sdc-accent-text: #ffffff;
--sdc-error: #b91c1c;
--demo-selecteur-date-calendrier-bg: #eeecf4;Free component: copy it freely, including for commercial projects.
Other forms and inputs components in WordPress
Forms and inputs components in WordPress
A quote request form for tradespeople: the customer describes the work, picks a start date range and attaches up to six site photos, each with a preview, its size and a button to remove it.
- Tailwind
- React
- CSS
- WordPress

A quote request form whose labels, hints and error messages are full French sentences, still readable at 320 px: nothing overflows, nothing is cut off, and each error is tied to its field.
- Tailwind
- React
- CSS
- WordPress

Visitors pick a package and tick options: the pre-tax total, VAT and total including tax update live, and the summary is sent with the contact form.
- Tailwind
- React
- CSS
- WordPress

A short NPS survey: a 0 to 10 score as radio buttons, then a follow-up question adapted to whether the customer is a detractor, passive or promoter.
- Tailwind
- React
- CSS
- WordPress

An honest unsubscribe page: address prefilled from the link, choice between stopping everything or receiving less, optional reason and an undo.
- Tailwind
- React
- CSS
- WordPress

A callback request form: French phone number checked and formatted, topic, working day and time slot, with explicit consent to the call.
- Tailwind
- React
- CSS
- WordPress