Customer review form in WordPress
A 1 to 5 star rating that works with the keyboard, a comment with a character counter, the first name, consent to publication and a thank-you message that recalls the rating.
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 dépôt d'avis
* Description: Une note de 1 à 5 étoiles utilisable au clavier, un commentaire avec compteur, le prénom, le consentement à la publication et un message de remerciement qui récapitule la note. Ajoute la composition « Formulaire de dépôt d'avis » à 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-avis-client
*<!-- wp:html -->
<section class="avf" aria-labelledby="avf-titre" data-avf>
<div class="avf__head">
<p class="avf__eyebrow">Fleurs de Léa · Annecy</p>
<h2 class="avf__title" id="avf-titre">Votre avis compte</h2>
<p class="avf__intro">Un bouquet livré, une composition de mariage, un conseil en boutique ? Racontez-nous ce que vous en avez pensé. Tous les champs sont obligatoires.</p>
</div>
<form class="avf__form" novalidate action="#avf-avis" aria-labelledby="avf-titre">
<fieldset class="avf__fieldset" aria-describedby="avf-rating-error">
<legend class="avf__legend">Votre note</legend>
<div class="avf__rating">
<div class="avf__stars">(() => {
if (!document.querySelector(".avf")) return;
const AVF_WORDS = ["Décevant", "Passable", "Bien", "Très bien", "Excellent"];
const AVF_MIN = 20;
const AVF_RULES = {
rating: (form) => (form.elements.rating.value ? "" : "Choisissez une note de 1 à 5 étoiles."),
comment: (form) => {
const length = form.elements.comment.value.trim().length;
if (!length) return "Écrivez quelques mots sur votre expérience.";
const missing = AVF_MIN - length;
return missing > 0 ? `Votre avis est un peu court : encore ${missing} caractère${missing > 1 ? "s" : ""} au minimum.` : "";:root {
--avf-card: #ffffff;
--avf-text: #2a1720;
--avf-muted: #6b4f5c;
--avf-line: #ecd9e1;
--avf-line-strong: #8c7280;
--avf-field: #ffffff;
--avf-accent: #9d174d;
--avf-accent-hover: #831843;
--avf-accent-soft: #fce7f3;
--avf-on-accent: #ffffff;
--avf-error: #b91c1c;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