Dual price range slider in WordPress
A two-handle slider to pick a price range, synced with two number fields and filtering the list live.
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, Curseur double pour fourchette de prix
* Description: Un curseur à deux poignées pour choisir une fourchette de prix, synchronisé avec deux champs nombre et qui filtre la liste en direct. Ajoute la composition « Curseur double pour fourchette de prix » à 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-curseur-double-prix
*<!-- wp:html -->
<section class="cdp" data-cdp aria-labelledby="cdp-titre">
<h2 class="cdp-title" id="cdp-titre">Mobilier vintage</h2>
<fieldset class="cdp-fs">
<legend class="cdp-legend">Prix : <output data-cdp-out>de 150 € à 700 €</output></legend>
<div class="cdp-slider" style="--cdp-lo: 12.50%; --cdp-hi: 58.33%" data-cdp-slider>
<span class="cdp-track" aria-hidden="true"><span class="cdp-fill"></span></span>
<input class="cdp-range" type="range" min="0" max="1200" step="10" value="150" aria-label="Prix minimum" data-cdp-range="lo">
<input class="cdp-range" type="range" min="0" max="1200" step="10" value="700" aria-label="Prix maximum" data-cdp-range="hi">
</div>
<div class="cdp-numbers">
<label class="cdp-nlabel">Minimum (€)<input class="cdp-number" type="number" min="0" max="1200" step="10" value="150" inputmode="numeric" data-cdp-number="lo"></label>(() => {
if (!document.querySelector(".cdp")) return;
document.querySelectorAll("[data-cdp]").forEach((root) => {
const on = (el, type, fn) => el.addEventListener(type, fn);
const ranges = { lo: root.querySelector('[data-cdp-range="lo"]'), hi: root.querySelector('[data-cdp-range="hi"]') };
const numbers = { lo: root.querySelector('[data-cdp-number="lo"]'), hi: root.querySelector('[data-cdp-number="hi"]') };
const slider = root.querySelector("[data-cdp-slider]");
const items = [...root.querySelectorAll("[data-cdp-price]")];
const min = Number(ranges.lo.min);
const max = Number(ranges.lo.max);
const step = Number(ranges.lo.step);
:root {
--cdp-card: #ffffff;
--cdp-text: #2a2017;
--cdp-muted: #5c4e40;
--cdp-line: #d8cdbf;
--cdp-field: #ffffff;
--cdp-track: #ece4d9;
--cdp-thumb: #b45309;
--cdp-thumb-ring: #ffffff;
--demo-curseur-double-prix-bg: #f2ece4;
--demo-curseur-double-prix-text: #2a2017;
}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