NPS satisfaction survey in 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.
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, Formulaire de satisfaction NPS
* Description: Une enquête NPS courte : note de 0 à 10 en boutons radio, puis une question de suivi adaptée selon que le client est détracteur, passif ou promoteur. Ajoute la composition « Formulaire de satisfaction NPS » à 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-formulaire-satisfaction-nps
*<!-- wp:html -->
<form class="fnp" data-fnp novalidate aria-labelledby="fnp-titre">
<p class="fnp-eyebrow">Votre avis · 30 secondes</p>
<fieldset class="fnp-fs" aria-describedby="fnp-err-note">
<legend class="fnp-legend" id="fnp-titre">Recommanderiez-vous notre service à un proche ?</legend>
<div class="fnp-wrap">
<div class="fnp-scale">
<label class="fnp-score"><input class="fnp-radio" type="radio" name="note" value="0" aria-describedby="fnp-bornes"><span>0</span></label>
<label class="fnp-score"><input class="fnp-radio" type="radio" name="note" value="1" aria-describedby="fnp-bornes"><span>1</span></label>
<label class="fnp-score"><input class="fnp-radio" type="radio" name="note" value="2" aria-describedby="fnp-bornes"><span>2</span></label>
<label class="fnp-score"><input class="fnp-radio" type="radio" name="note" value="3" aria-describedby="fnp-bornes"><span>3</span></label>
<label class="fnp-score"><input class="fnp-radio" type="radio" name="note" value="4" aria-describedby="fnp-bornes"><span>4</span></label>(() => {
if (!document.querySelector(".fnp")) return;
document.querySelectorAll("[data-fnp]").forEach((root) => {
const on = (el, type, fn) => el.addEventListener(type, fn);
const scores = [...root.querySelectorAll('[name="note"]')];
const follow = root.querySelector("[data-fnp-follow]");
const question = root.querySelector("[data-fnp-question]");
const comment = root.querySelector('[name="commentaire"]');
const counter = root.querySelector("[data-fnp-counter]");
const status = root.querySelector("[data-fnp-status]");
const fieldset = scores[0].closest("fieldset");
const questions = {:root {
--fnp-card: #ffffff;
--fnp-text: #241a2b;
--fnp-muted: #574c5f;
--fnp-accent: #a3155f;
--fnp-line: #ddcfe0;
--fnp-soft: #fbeef4;
--fnp-error: #b42318;
--demo-formulaire-satisfaction-nps-bg: #f3ebf2;
--demo-formulaire-satisfaction-nps-text: #241a2b;
}
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

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

A SIRET or SIREN field that checks the Luhn key as you type, handles the La Poste exception, formats the number and links to the official business directory.
- Tailwind
- React
- CSS
- WordPress