Skip to content

Quote lines table in WordPress

Quote lines with editable quantities, an ex-VAT total per line, VAT broken down by rate (5.5, 10 and 20 %) and a recalculated grand total; each line becomes a card on phones.

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

Open in a new tab

The code in WordPress

pattern.html
<!-- wp:html -->
<form class="tdv" data-tdv aria-labelledby="tdv-titre">
        <div class="tdv-top">
          <div>
            <p class="tdv-eyebrow">Devis n° 2027-041 · Plomberie Ribeiro, Bordeaux</p>
            <h2 class="tdv-title" id="tdv-titre">Rénovation de la salle de bains</h2>
          </div>
          <p class="tdv-valid">Valable jusqu’au <time datetime="2027-03-31">31 mars 2027</time></p>
        </div>
        <div class="tdv-scroll">
          <table class="tdv-table">
            <caption class="tdv-sr">Lignes du devis, quantités modifiables</caption>
script.js
(() => {
  if (!document.querySelector(".tdv")) return;
  document.querySelectorAll("[data-tdv]").forEach((root) => {
    const on = (el, type, fn) => el.addEventListener(type, fn);
    const money = new Intl.NumberFormat("fr-FR", { style: "currency", currency: "EUR" });
    const eur = (cents) => money.format(Math.round(cents) / 100);
    const lines = [...root.querySelectorAll("[data-tdv-line]")];
    const status = root.querySelector("[data-tdv-status]");

    const apply = () => {
      let ht = 0;
      const vat = new Map();
style.css
:root {
  --tdv-card: #ffffff;
  --tdv-text: #182031;
  --tdv-muted: #4c5770;
  --tdv-line: #dce2ec;
  --tdv-soft: #f1f4fa;
  --tdv-accent: #1e40af;
  --demo-tableau-devis-lignes-bg: #e8ecf3;
  --demo-tableau-devis-lignes-text: #182031;
}

@media (prefers-color-scheme: dark) {
tableau-devis-lignes.php
<?php
/**
 * Plugin Name: Forge, Tableau de lignes de devis
 * Description: Les lignes d’un devis avec quantités modifiables, total HT par ligne, TVA ventilée par taux (5,5, 10 et 20 %) et total TTC recalculé ; chaque ligne devient une carte sur téléphone. Ajoute la composition « Tableau de lignes de devis » à 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-devis-lignes
 *

Free component: copy it freely, including for commercial projects.

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
    Component
  • 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
    Component
  • 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
    Component
  • 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
    Component
  • 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
    Component
  • 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
    Component