TableCrafter.js
Zero-dependency vanilla JS data table. ~27 KB min+gz. MIT licensed. Framework-agnostic.
TableCrafter.js turns any JavaScript array, REST URL, or CSV into a fully interactive, editable, mobile-ready data table with a single constructor call. No framework, no build step, no server required.
Quick start
Include the CSS and UMD script from jsDelivr, then drop a data-tc-bootstrap element onto the page:
<!-- 1. Add styles and script from jsDelivr -->
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/tablecrafter@2/dist/tablecrafter.css">
<script src="https://cdn.jsdelivr.net/npm/tablecrafter@2/dist/tablecrafter.umd.min.js"></script>
<!-- 2. Declare a table with data-tc-bootstrap -->
<div data-tc-bootstrap
data-tc-config='{
"columns":[{"field":"name","label":"Name"},{"field":"role","label":"Role"}],
"data":[{"name":"Alice","role":"Engineer"},{"name":"Bob","role":"Designer"}],
"filterable":true,
"sortable":true
}'></div>
<!-- 3. Auto-init all data-tc-bootstrap elements on the page -->
<script>
const tables = TableCrafter.bootstrap(); // returns Map<HTMLElement, TableCrafter>
</script>
For JavaScript-driven initialization, use the constructor directly:
const table = new TableCrafter('#my-table', {
data: '/api/employees',
columns: [
{ field: 'id', label: 'ID' },
{ field: 'name', label: 'Name', editable: true },
{ field: 'email', label: 'Email', editable: true, type: 'email' },
],
editable: true,
filterable: true,
pagination: true,
});
table.render();
Features
Display
enableVirtualScroll(); handles large datasets without paginationcellType:'heatmap'); all ARIA-labeledEditing and validation
ownOnly ownershipExtensibility and export
on / off / once for 8 named events; each on() returns an unsubscribe functionuse(plugin) / unuse(name) with lifecycle pairs: beforeRender/afterRender, beforeSort, beforeEdit/afterEdit, beforeLoad/afterLoad, destroyxlsx for spreadsheets; jspdf + jspdf-autotable for PDFRelationship to the TableCrafter WordPress plugin
TableCrafter.js shares feature DNA with the TableCrafter WordPress plugin and is tracking full parity on client-side capabilities. The plugin adds server-side concerns the library deliberately omits: Gravity Forms write-back, Gutenberg and Elementor blocks, scheduled exports, encrypted data source credentials, and WordPress user-role integration. The library covers these use cases through its own api.* config, permissions object, and plugin system.
The current gap status between the two is tracked in docs/PARITY.md.
v3 is coming
Links
- GitHub repository (source, issues, and releases)
- npm: coming to npm as
tablecrafter - Examples directory on GitHub (runnable HTML files)
- Feature parity matrix (library vs. WordPress plugin)
- v3 RFC