Mobile-friendly plan comparison in WordPress
A full plan comparison table on large screens; on phones the criteria stay visible and you pick which plan is shown next to them.
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 -->
<section class="cfm" data-cfm aria-labelledby="cfm-titre">
<p class="cfm-eyebrow">La Ruche · coworking à Nantes</p>
<h2 class="cfm-title" id="cfm-titre">Comparez nos formules</h2>
<fieldset class="cfm-pick" data-cfm-pick hidden>
<legend class="cfm-legend">Formule affichée à côté des critères</legend>
<label class="cfm-chip"><input class="cfm-radio" type="radio" name="cfm-plan" value="2"><span class="cfm-chip-text">Nomade</span></label>
<label class="cfm-chip"><input class="cfm-radio" type="radio" name="cfm-plan" value="3" checked><span class="cfm-chip-text">Résident</span></label>
<label class="cfm-chip"><input class="cfm-radio" type="radio" name="cfm-plan" value="4"><span class="cfm-chip-text">Équipe</span></label>
</fieldset>
<div class="cfm-scroll" tabindex="0" role="region" aria-label="Tableau comparatif des formules">
<table class="cfm-table" data-cfm-table>(() => {
if (!document.querySelector(".cfm")) return;
document.querySelectorAll("[data-cfm]").forEach((root) => {
const on = (el, type, fn) => el.addEventListener(type, fn);
const table = root.querySelector("[data-cfm-table]");
const pick = root.querySelector("[data-cfm-pick]");
const apply = () => {
table.dataset.cfmCol = pick.querySelector("input:checked").value;
};
pick.hidden = false;:root {
--cfm-card: #ffffff;
--cfm-text: #1a2421;
--cfm-muted: #4c5a55;
--cfm-line: #dbe3df;
--cfm-soft: #eef5f1;
--cfm-accent: #0f766e;
--cfm-accent-text: #ffffff;
--demo-tableau-comparatif-forfaits-mobile-bg: #e8eeeb;
--demo-tableau-comparatif-forfaits-mobile-text: #1a2421;
}
<?php
/**
* Plugin Name: Forge, Comparatif de forfaits adapté au téléphone
* Description: Un tableau comparatif de formules complet sur grand écran ; sur téléphone, les critères restent visibles et l’on choisit la formule affichée à côté. Ajoute la composition « Comparatif de forfaits adapté au téléphone » à 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-tableau-comparatif-forfaits-mobile
*Free component: copy it freely, including for commercial projects.
Other data tables components in WordPress
Data tables components in WordPress
A documentation table showing where a kit or component has been tested (static HTML, WordPress, Elementor, Webflow, v0…), with status, last test date and a remark, filterable by status.
- Tailwind
- React
- CSS
- WordPress

A table of the towns and postcodes a tradesperson covers, with response time and travel fee, filtered by search and by zone.
- Tailwind
- React
- CSS
- WordPress

A timetable table sorted by column and filtered with level and free-place chips, whose rows each become a card on phones.
- Tailwind
- React
- CSS
- WordPress

A filterable table whose visible rows export in one click to a CSV file that opens cleanly in Excel or LibreOffice.
- Tailwind
- React
- CSS
- WordPress

A price table by service: one package to pick, options to tick, and the total with the estimated time recalculated on every click.
- Tailwind
- React
- CSS
- WordPress

A product spec sheet as two-column tables in native collapsible sections, with a button to open or close them all.
- Tailwind
- React
- CSS
- WordPress