Table with search and filters in WordPress
A directory table filtered by free search and by category, with the result count announced and rows turned into cards 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
The code in WordPress
<!-- wp:html -->
<section class="trf" data-trf aria-labelledby="trf-titre">
<h2 class="trf-title" id="trf-titre">Annuaire des associations</h2>
<div class="trf-filters" role="search" aria-label="Filtrer les associations" data-trf-filters hidden>
<div class="trf-field">
<label class="trf-label" for="trf-q">Rechercher</label>
<input class="trf-input" id="trf-q" type="search" placeholder="Nom, lieu, jour…" autocomplete="off">
</div>
<div class="trf-field">
<label class="trf-label" for="trf-cat">Catégorie</label>
<select class="trf-input" id="trf-cat">
<option value="">Toutes</option>(() => {
if (!document.querySelector(".trf")) return;
document.querySelectorAll("[data-trf]").forEach((root) => {
const on = (el, type, fn) => el.addEventListener(type, fn);
const q = root.querySelector("#trf-q");
const cat = root.querySelector("#trf-cat");
const rows = [...root.querySelectorAll("[data-trf-row]")];
const fold = (s) =>
s
.normalize("NFD")
.replace(/[\u0300-\u036f]/g, "")
.toLowerCase();:root {
--trf-card: #ffffff;
--trf-text: #1a2131;
--trf-muted: #4b5563;
--trf-line: #dde2ea;
--trf-field: #ffffff;
--trf-head: #f3f5f9;
--trf-chip: #eef2ff;
--trf-chip-text: #3730a3;
--trf-accent: #4338ca;
--demo-tableau-recherche-filtres-bg: #eceff4;
--demo-tableau-recherche-filtres-text: #1a2131;<?php
/**
* Plugin Name: Forge, Tableau avec recherche et filtres
* Description: Un annuaire en tableau que l’on filtre par recherche libre et par catégorie, avec nombre de résultats annoncé et lignes en cartes sur téléphone. Ajoute la composition « Tableau avec recherche et filtres » à 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-recherche-filtres
*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