{"id":274,"date":"2026-11-27T05:44:35","date_gmt":"2026-11-27T05:44:35","guid":{"rendered":"https:\/\/webdevpuneet.com\/blog\/?p=274"},"modified":"2026-11-27T05:44:38","modified_gmt":"2026-11-27T05:44:38","slug":"10-copy-paste-table-snippets-that-replace-a-data-grid-library","status":"publish","type":"post","link":"https:\/\/webdevpuneet.com\/blog\/10-copy-paste-table-snippets-that-replace-a-data-grid-library\/","title":{"rendered":"10 Copy-Paste Table Snippets That Replace a Data Grid Library"},"content":{"rendered":"<p><!--\n================================================================\n  POST TITLE (paste into the WordPress title field \u2014 it becomes the page H1)\n  10 Copy-Paste Table Snippets That Replace a Data Grid Library\n\n  SEO TITLE (50 chars, target 50\u201360, max 60 \u2014 \"Optimize SEO\" panel \u2192 SEO TITLE)\n  10 Table Snippets That Replace a Data Grid Library\n\n  SEO DESCRIPTION (159 chars, target 150\u2013160, max 160 \u2014 \"Optimize SEO\" panel \u2192 SEO DESCRIPTION)\n  10 free table snippets with sorting, filtering, pagination, selection and export. Skip the heavy data grid library. Preview live and copy the HTML, CSS and JS.\n================================================================\n--><\/p>\n\n\n<p class=\"wp-block-paragraph\">The moment a project needs to show a list of records, someone suggests installing a data grid. It&#8217;s an understandable reflex \u2014 sorting, filtering, pagination, selection and export sound like a lot of work \u2014 but the honest version of most requirements is &#8220;a table with three or four of those features,&#8221; and a grid library answers it with a large dependency, its own data conventions, and a theming system you&#8217;ll spend a day fighting. Below are 10 free table snippets you can preview live and copy in seconds: a complete admin table, click-to-sort headers, per-column filters, client-side pagination, frozen header and first column, row selection with a bulk action bar, inline cell editing, expandable detail rows, a correct CSV export, and a real pivot table.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Each one comes with <strong>how it actually works<\/strong>, <strong>when to reach for it<\/strong>, and a tip for adapting it. They&#8217;re all plain HTML, CSS, and vanilla JavaScript over a real <code>&lt;table&gt;<\/code> \u2014 no grid library, no virtual DOM, no build step.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Every snippet below is a <strong>live, interactive preview<\/strong> \u2014 sort it, filter it, page through it, right in the article. When you find one you like, hit <strong>View \/ Edit Code<\/strong> to grab the HTML\/CSS\/JS or export it to React, Vue, Angular or Tailwind.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What makes a table usable rather than just present<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Tables fail in a small number of predictable ways, and each snippet below fixes at least one of them:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Sort and format are two different things.<\/strong> A column showing &#8220;$89.99&#8221; is text to a computer. If the raw value isn&#8217;t kept somewhere the code can reach, sorting silently produces nonsense \u2014 and nobody notices until a customer does.<\/li>\n\n\n\n<li><strong>State belongs in data, not in the DOM.<\/strong> Which rows are selected, which page you&#8217;re on, which columns are visible \u2014 the snippets that survive real use keep those in a variable and re-derive the markup from it. The ones that read checked-ness back out of the DOM drift out of sync the first time anything re-renders.<\/li>\n\n\n\n<li><strong>The screen has edges.<\/strong> Wide tables scroll sideways and long ones scroll down, and both lose the context that made the numbers meaningful. Sticky headers, frozen columns and pagination all exist for the same reason.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Keep those three in mind as you scroll.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. Data Table<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The complete admin table you&#8217;d otherwise assemble from four separate tutorials: live search with a result count, status badges, row checkboxes with select-all, gradient avatar initials, Edit and Remove row actions, and a styled pagination footer.<\/p>\n\n\n\n<iframe src=\"https:\/\/webdevpuneet.com\/ui-snippets\/data-table\/embed\/\" style=\"width:100%;height:480px;border:0;border-radius:10px;overflow:hidden;\" loading=\"lazy\" title=\"Data Table \u2014 Free HTML\/CSS\/JS Snippet by webdevpuneet.com\"><\/iframe>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How it works:<\/strong> the search is deliberately na\u00efve in the best way \u2014 for each row it reads <code>row.textContent<\/code>, which returns every visible character in that row as one string, and checks whether the lowercased search term appears in it. One <code>includes()<\/code> matches name, email, role, department and status simultaneously, with no per-column logic and no need to touch the function when you add a column. Non-matching rows get a class that sets <code>display: none<\/code>, and the same pass counts the survivors for the &#8220;Showing 3 of 5&#8221; line in the footer. The avatars are initials on a CSS gradient rather than images, so there&#8217;s nothing to load and nothing to break when a URL 404s.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Best for:<\/strong> the user, order or record list at the centre of any admin panel \u2014 the screen you build first and then keep adding to. <strong>Tip:<\/strong> that <code>textContent<\/code> search is perfect up to a few hundred rows and quietly wrong beyond them, because it scans every row on every keystroke. Past that point, debounce the input by ~150&nbsp;ms before you reach for anything cleverer. The pagination footer here is styled markup rather than working paging \u2014 drop in the logic from snippet 4 below when you need it to do something.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Grab the code: <a href=\"https:\/\/webdevpuneet.com\/ui-snippets\/data-table\/\">Data Table<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. Sortable Table<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Click a header to sort ascending, click again for descending, with an arrow indicator on the active column \u2014 and correct numeric ordering on columns that display currency symbols.<\/p>\n\n\n\n<iframe src=\"https:\/\/webdevpuneet.com\/ui-snippets\/sortable-table\/embed\/\" style=\"width:100%;height:480px;border:0;border-radius:10px;overflow:hidden;\" loading=\"lazy\" title=\"Sortable Table \u2014 Free HTML\/CSS\/JS Snippet by webdevpuneet.com\"><\/iframe>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How it works:<\/strong> each sortable header carries <code>data-col<\/code> (which column index) and optionally <code>data-type=\"number\"<\/code>, and the handler reads the header&#8217;s current class to decide the next direction. Rows are spread into an array, sorted, and re-appended \u2014 the DOM order <em>is<\/em> the sort result, so nothing needs re-rendering. The important part is the <code>data-val<\/code> attribute on formatted cells: a cell reading &#8220;$149&#8221; also carries <code>data-val=\"149\"<\/code>, because <code>parseFloat(\"$149\")<\/code> returns <code>NaN<\/code> and a table sorted on <code>NaN<\/code> just shuffles. The direction arrow is a CSS <code>::after<\/code> driven by the header&#8217;s class, so JavaScript never touches it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Best for:<\/strong> any table where &#8220;cheapest first&#8221; or &#8220;newest first&#8221; is a question users will ask \u2014 which is nearly all of them. <strong>Tip:<\/strong> the <code>data-val<\/code> pattern generalises further than prices. Mark a date column <code>data-type=\"number\"<\/code> and put a sortable number in each cell&#8217;s <code>data-val<\/code> (<code>20260314<\/code> for a cell showing &#8220;14 Mar&#8221;), or a rank number for a column showing status badges, and the same comparison sorts them correctly. Only numeric columns read <code>data-val<\/code>; text columns sort on what&#8217;s displayed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Grab the code: <a href=\"https:\/\/webdevpuneet.com\/ui-snippets\/sortable-table\/\">Sortable Table<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. Filterable Table<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A filter input in every column header, combined with AND logic, plus match highlighting, a numeric minimum filter, a live result count and a clear-all button.<\/p>\n\n\n\n<iframe src=\"https:\/\/webdevpuneet.com\/ui-snippets\/filterable-table\/embed\/\" style=\"width:100%;height:480px;border:0;border-radius:10px;overflow:hidden;\" loading=\"lazy\" title=\"Filterable Table \u2014 Free HTML\/CSS\/JS Snippet by webdevpuneet.com\"><\/iframe>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How it works:<\/strong> each header input writes into a <code>filters<\/code> array indexed by column, and a row survives only if it satisfies <em>every<\/em> active filter \u2014 which is the whole point, because &#8220;Engineering <em>and<\/em> Berlin&#8221; is a question a single search box cannot express. Text columns match case-insensitive substrings; the salary column is treated as a <em>minimum<\/em> instead, since nobody searches a salary for the characters &#8220;100000&#8221;. Matches are wrapped in a <code>&lt;mark&gt;<\/code>, and the order there matters: the cell text is HTML-escaped first and only then is the matched slice wrapped, so a value containing <code>&lt;<\/code> or <code>&amp;<\/code> can never inject markup.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Best for:<\/strong> reporting screens and directories \u2014 anywhere users arrive knowing two or three things about the record they want. <strong>Tip:<\/strong> the count, the empty state and the clear button look like polish and aren&#8217;t. Without them a user who filters down to zero rows sees a blank table and assumes it&#8217;s broken.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Grab the code: <a href=\"https:\/\/webdevpuneet.com\/ui-snippets\/filterable-table\/\">Filterable Table<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. Pagination Table<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Client-side paging done properly: smart page numbers with an ellipsis for the gaps, prev\/next buttons that disable at the ends, a rows-per-page selector, and a &#8220;Showing 1\u201310 of 48 results&#8221; info bar.<\/p>\n\n\n\n<iframe src=\"https:\/\/webdevpuneet.com\/ui-snippets\/pagination-table\/embed\/\" style=\"width:100%;height:480px;border:0;border-radius:10px;overflow:hidden;\" loading=\"lazy\" title=\"Pagination Table \u2014 Free HTML\/CSS\/JS Snippet by webdevpuneet.com\"><\/iframe>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How it works:<\/strong> the full dataset lives in an array and the render pass slices it \u2014 <code>start = (page - 1) * perPage<\/code>, then <code>data.slice(start, end)<\/code> \u2014 rebuilding the body and the controls together on every change. The page buttons are the part most hand-rolled paginations get wrong: rather than printing every page number, it shows the first page, the pages either side of the current one, and the last page, running the result through a <code>Set<\/code> to deduplicate and dropping an ellipsis into the gaps. Changing the rows-per-page selector also resets to page 1, so you can never be left stranded on a page number that no longer exists.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Best for:<\/strong> any list past a couple of screens, and the default choice over infinite scroll whenever users need to find a specific record rather than browse. <strong>Tip:<\/strong> moving to server-side paging changes surprisingly little \u2014 swap the <code>slice()<\/code> for a fetch with <code>page<\/code> and <code>limit<\/code> parameters and compute the button range from the total count the API returns.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Grab the code: <a href=\"https:\/\/webdevpuneet.com\/ui-snippets\/pagination-table\/\">Pagination Table<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5. Sticky Header Table<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Frozen panes, the spreadsheet feature every wide table needs: the header row pinned to the top and the first column pinned to the left, both staying put while the rest scrolls in two directions \u2014 with no JavaScript at all.<\/p>\n\n\n\n<iframe src=\"https:\/\/webdevpuneet.com\/ui-snippets\/sticky-header-table\/embed\/\" style=\"width:100%;height:480px;border:0;border-radius:10px;overflow:hidden;\" loading=\"lazy\" title=\"Sticky Header Table \u2014 Free HTML\/CSS\/JS Snippet by webdevpuneet.com\"><\/iframe>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How it works:<\/strong> three <code>position: sticky<\/code> rules inside a scrolling container \u2014 <code>top: 0<\/code> on the header cells, <code>left: 0<\/code> on the first column, and <em>both<\/em> on the corner cell that belongs to each. Stacking order is what makes or breaks it: the header sits at <code>z-index: 2<\/code>, the frozen column at <code>1<\/code>, and the corner at <code>3<\/code> so it stays above both where they cross. Each sticky cell also needs an opaque background, or scrolled content shows straight through it. And the whole thing uses <code>border-collapse: separate<\/code>, because sticky positioning is unreliable with collapsed borders \u2014 those belong to the table rather than the cells \u2014 so row dividers are drawn per cell instead.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Best for:<\/strong> wide financial, analytics and comparison tables where losing the column heading means losing the meaning of the number you&#8217;re looking at. <strong>Tip:<\/strong> freeze exactly one column. Two feels like control and leaves phone users a sliver of scrollable width.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Grab the code: <a href=\"https:\/\/webdevpuneet.com\/ui-snippets\/sticky-header-table\/\">Sticky Header Table<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">6. Selectable Table<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Row selection with the details that make it feel professional: a tri-state select-all header, shift-click to grab a range, whole-row click targets, a live count, and a bulk Delete button that appears only when something is selected.<\/p>\n\n\n\n<iframe src=\"https:\/\/webdevpuneet.com\/ui-snippets\/selectable-table\/embed\/\" style=\"width:100%;height:480px;border:0;border-radius:10px;overflow:hidden;\" loading=\"lazy\" title=\"Selectable Table \u2014 Free HTML\/CSS\/JS Snippet by webdevpuneet.com\"><\/iframe>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How it works:<\/strong> the selection lives in a <code>Set<\/code> and everything visible is derived from it in one refresh pass \u2014 the row highlights, the checkboxes, the count, and the header&#8217;s state. That header checkbox is <em>checked<\/em> when all rows are selected, <em>indeterminate<\/em> when only some are, and empty when none are; skip the middle state, as most hand-built tables do, and a half-selected table shows a fully-ticked header, which is simply a lie. Shift-click remembers the last index clicked and adds the whole range between it and the new row, the same gesture your file manager uses.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Best for:<\/strong> any table with bulk operations behind it \u2014 delete, export, assign, tag. <strong>Tip:<\/strong> this demo stores row <em>indices<\/em> in the Set, which is fine for one static page and breaks the instant rows are sorted or paginated, because index 2 is now a different record. Store stable ids instead before you ship it. If you want the floating toolbar as its own component, the <a href=\"https:\/\/webdevpuneet.com\/ui-snippets\/bulk-actions-bar\/\">Bulk Actions Bar<\/a> snippet isolates that half.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Grab the code: <a href=\"https:\/\/webdevpuneet.com\/ui-snippets\/selectable-table\/\">Selectable Table<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">7. Editable Table<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Spreadsheet-style inline editing: every cell is a text field that looks like plain text until you click it, with add-row, delete-row, a live row count and a save button.<\/p>\n\n\n\n<iframe src=\"https:\/\/webdevpuneet.com\/ui-snippets\/editable-table\/embed\/\" style=\"width:100%;height:480px;border:0;border-radius:10px;overflow:hidden;\" loading=\"lazy\" title=\"Editable Table \u2014 Free HTML\/CSS\/JS Snippet by webdevpuneet.com\"><\/iframe>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How it works:<\/strong> the trick is entirely in the CSS. Each cell holds a real <code>&lt;input&gt;<\/code> with a transparent border and background, so it reads as text; on hover a faint border appears, and on focus a full indigo border with a soft shadow ring. Nothing is swapped in or out of the DOM, which is why there&#8217;s no flicker and no lost keystroke when you click straight from one cell into another. The data binding is deliberately plain: each input writes back to <code>rows[i][key]<\/code> as you type, and adding or deleting a row re-renders the table from that array, so the array is always the truth and there&#8217;s no two-way binding machinery to reason about. A new row slides in with an animation and auto-focuses its first cell.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Best for:<\/strong> settings tables, team and pricing management, CMS field editors \u2014 anywhere users change several small values in one sitting and a modal per row would be torture. <strong>Tip:<\/strong> add a &#8220;saved&#8221; indicator or an autosave debounce. An explicit save button is honest, but a table full of edits and no feedback makes people re-check every field before they trust it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Grab the code: <a href=\"https:\/\/webdevpuneet.com\/ui-snippets\/editable-table\/\">Editable Table<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">8. Expandable Rows Table<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Summary rows that open to reveal their detail \u2014 click an order and its line items unfold underneath, with a rotating chevron and accordion behaviour so only one is open at a time.<\/p>\n\n\n\n<iframe src=\"https:\/\/webdevpuneet.com\/ui-snippets\/expandable-table\/embed\/\" style=\"width:100%;height:480px;border:0;border-radius:10px;overflow:hidden;\" loading=\"lazy\" title=\"Expandable Rows Table \u2014 Free HTML\/CSS\/JS Snippet by webdevpuneet.com\"><\/iframe>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How it works:<\/strong> every visible row is paired with a hidden detail row directly beneath it, tied together by the row&#8217;s <code>data-id<\/code> and a matching <code>id<\/code> on its detail row. Toggling adds a class to both; the detail row&#8217;s CSS flips from <code>display: none<\/code> to <code>display: table-row<\/code>, which is the specific value that keeps it inside the table&#8217;s layout rather than collapsing it into a block. Before opening one, the handler closes any that are open \u2014 accordion behaviour, and deleting that block is all it takes to allow several at once. The detail cell spans every column with <code>colspan<\/code> and holds a nested table with its own header, indented behind an accent left border so the hierarchy is visible at a glance.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Best for:<\/strong> orders and their line items, invoices, expense categories, test suites and their cases \u2014 any parent record whose detail is too much for a column but too little for its own page. <strong>Tip:<\/strong> if you change the outer column count, update the <code>colspan<\/code> to match, or the detail panel will sit misaligned under a table that otherwise looks fine. For genuinely recursive data rather than two fixed levels, the <a href=\"https:\/\/webdevpuneet.com\/ui-snippets\/tree-table\/\">Tree Table<\/a> handles unlimited nesting.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Grab the code: <a href=\"https:\/\/webdevpuneet.com\/ui-snippets\/expandable-table\/\">Expandable Rows Table<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">9. CSV Export Table<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8220;Export to CSV&#8221; button every table eventually needs, implemented correctly: RFC-4180 quoting, a UTF-8 BOM so Excel doesn&#8217;t mangle accents, a dated filename, and no server round-trip.<\/p>\n\n\n\n<iframe src=\"https:\/\/webdevpuneet.com\/ui-snippets\/csv-export-table\/embed\/\" style=\"width:100%;height:480px;border:0;border-radius:10px;overflow:hidden;\" loading=\"lazy\" title=\"CSV Export Table \u2014 Free HTML\/CSS\/JS Snippet by webdevpuneet.com\"><\/iframe>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How it works:<\/strong> one small function does the load-bearing work. A value is wrapped in double quotes, with its own quotes doubled, only when it contains a comma, a quote, or a newline \u2014 exactly the RFC-4180 rule \u2014 so <code>Marco \"Cosmo\" Rossi<\/code> exports as <code>\"Marco \"\"Cosmo\"\" Rossi\"<\/code> and an address with a comma in it stays in one column instead of spilling into the next. The file then gets a UTF-8 byte-order mark prepended, which is the one-character difference between Excel showing &#8220;Caf\u00e9&#8221; and showing &#8220;Caf\u00c3\u00a9&#8221;. The string becomes a <code>Blob<\/code>, an object URL, and a programmatically clicked <code>&lt;a download&gt;<\/code> \u2014 the data never leaves the device.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Best for:<\/strong> any admin screen where someone will eventually say &#8220;can I get this in a spreadsheet?&#8221; \u2014 which is every admin screen. <strong>Tip:<\/strong> this exports the rows currently in the page&#8217;s data. Once your table is paginated or filtered server-side, that silently becomes &#8220;export page 1 of 40&#8221;, so point the button at an endpoint that streams the full dataset through the same escaping rules.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Grab the code: <a href=\"https:\/\/webdevpuneet.com\/ui-snippets\/csv-export-table\/\">CSV Export Table<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">10. Pivot Table<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The spreadsheet feature people assume needs a BI tool: flat records cross-tabulated by row and column, with switchable sum\/average\/count measures and correct totals on both axes.<\/p>\n\n\n\n<iframe src=\"https:\/\/webdevpuneet.com\/ui-snippets\/pivot-table\/embed\/\" style=\"width:100%;height:480px;border:0;border-radius:10px;overflow:hidden;\" loading=\"lazy\" title=\"Pivot Table \u2014 Free HTML\/CSS\/JS Snippet by webdevpuneet.com\"><\/iframe>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How it works:<\/strong> three constants at the top name which field becomes the rows, which becomes the columns, and which is being measured. The code derives the unique values of each dimension from the data itself, then for every row\/column intersection filters the records matching both and aggregates them. Every cell, every row total, every column total and the grand total run through one <code>aggregate()<\/code> function, which is what keeps the measure switch consistent. And the totals are computed from the <em>raw records<\/em>, never by adding up the displayed cells \u2014 for sum that happens to be the same answer, but averaging a row of averages is mathematically wrong, and getting that right is the line between a pivot and a grid of numbers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Best for:<\/strong> sales by region and quarter, spend by category and month, survey cross-tabs, inventory by location and type \u2014 any moment someone exports to a spreadsheet purely to build a pivot. <strong>Tip:<\/strong> the demo filters the whole dataset once per cell, which is clear to read and fine for dozens of intersections. Over thousands of records, group the records once into a map keyed by row-plus-column and read each cell from it instead.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Grab the code: <a href=\"https:\/\/webdevpuneet.com\/ui-snippets\/pivot-table\/\">Pivot Table<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to drop these into your project<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Every snippet is framework-agnostic, so the workflow is the same wherever you&#8217;re building:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open the snippet and hit <strong>View \/ Edit Code<\/strong> to see the HTML, CSS and JS in separate tabs.<\/li>\n\n\n\n<li>Paste the HTML into your markup, the CSS into your stylesheet, and the JS before your closing <code>&lt;\/body&gt;<\/code> tag \u2014 none of these ten need a CDN script or a build step.<\/li>\n\n\n\n<li>Prefer a component? Use the one-click <strong>export to React, Vue, Angular or Tailwind<\/strong> right from the snippet page.<\/li>\n\n\n\n<li>Replace the demo array (or the sample rows) with your API response. Most of these render from data, so that&#8217;s the only change between mockup and working screen.<\/li>\n\n\n\n<li>Combining two is straightforward because they all use the same <code>thead<\/code>\/<code>tbody<\/code> structure. Just pick one owner for the rows: keep the data in an array, sort and filter the array, then slice it for the current page and render, rather than letting each feature rearrange the DOM on its own.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">A few table principles worth keeping<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Keep the sortable value next to the readable one.<\/strong> Format for humans in the cell, store the raw number or ISO date in <code>data-val<\/code>, and sorting, filtering and export all stay correct for free.<\/li>\n\n\n\n<li><strong>Let one structure own the state.<\/strong> The <code>Set<\/code> in the selectable table, the array in the editable table, the column config in a toggle \u2014 a single source that the DOM is rendered from, rather than state read back out of the DOM.<\/li>\n\n\n\n<li><strong>Use a real <code>&lt;table&gt;<\/code>.<\/strong> Every snippet here does. You get column alignment, screen-reader row and column semantics, and <code>colspan<\/code> for free \u2014 all of which a grid of divs has to reimplement badly.<\/li>\n\n\n\n<li><strong>Add features on demand, not in advance.<\/strong> Each of these is a few dozen lines. Install the dependency the day you genuinely need column virtualisation over 50,000 rows, not on the assumption you might.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Final Thought<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">These ten cover the whole life of a table \u2014 show the records, sort them, filter them, page them, keep the headings visible, select and act in bulk, edit in place, drill into detail, export to a spreadsheet, and summarise into a cross-tab. Start with the <a href=\"https:\/\/webdevpuneet.com\/ui-snippets\/data-table\/\">Data Table<\/a> and layer on only what your users actually request. When they want more, the same library has a <a href=\"https:\/\/webdevpuneet.com\/ui-snippets\/resizable-columns-table\/\">Resizable Columns Table<\/a> with double-click auto-fit, a <a href=\"https:\/\/webdevpuneet.com\/ui-snippets\/data-table-column-toggle\/\">Column Toggle<\/a> for dense grids, an <a href=\"https:\/\/webdevpuneet.com\/ui-snippets\/infinite-scroll-table\/\">Infinite Scroll Table<\/a> that lazy-loads pages with an IntersectionObserver sentinel, and a <a href=\"https:\/\/webdevpuneet.com\/ui-snippets\/bar-chart\/\">Bar Chart<\/a> for when the numbers deserve a picture \u2014 all dependency-free too.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Preview any of them live, tweak the code, and export to your framework of choice in one click. Browse the full collection at <a href=\"https:\/\/webdevpuneet.com\/ui-snippets\/\">webdevpuneet UI Snippets<\/a> \u2014 it&#8217;s free and runs entirely in your browser.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The moment a project needs to show a list of records, someone suggests installing a data grid. It&#8217;s an understandable reflex \u2014 sorting, filtering, pagination, selection and export sound like a lot of work \u2014 but the honest version of most requirements is &#8220;a table with three or four of those features,&#8221; and a grid [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":275,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","advanced_seo_description":"10 free table snippets with sorting, filtering, pagination, selection and export. Skip the heavy data grid library. Preview live and copy the HTML, CSS and JS.","jetpack_seo_html_title":"10 Table Snippets That Replace a Data Grid Library","jetpack_seo_noindex":false,"jetpack_seo_schema_type":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"10 free table snippets with sorting, filtering, pagination, selection and export. Skip the heavy data grid library. Preview live and copy the HTML, CSS and JS.\n\n#HTMLTables #JavaScript #WebDevelopment","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[14],"tags":[],"class_list":["post-274","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ui-snippets","et-has-post-format-content","et_post_format-et-post-format-standard"],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/phrh5V-4q","jetpack_featured_media_url":"https:\/\/i0.wp.com\/webdevpuneet.com\/blog\/wp-content\/uploads\/2026\/11\/blog14-tables-featured.jpg?fit=1200%2C630&ssl=1","_links":{"self":[{"href":"https:\/\/webdevpuneet.com\/blog\/wp-json\/wp\/v2\/posts\/274","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webdevpuneet.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webdevpuneet.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webdevpuneet.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webdevpuneet.com\/blog\/wp-json\/wp\/v2\/comments?post=274"}],"version-history":[{"count":1,"href":"https:\/\/webdevpuneet.com\/blog\/wp-json\/wp\/v2\/posts\/274\/revisions"}],"predecessor-version":[{"id":276,"href":"https:\/\/webdevpuneet.com\/blog\/wp-json\/wp\/v2\/posts\/274\/revisions\/276"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webdevpuneet.com\/blog\/wp-json\/wp\/v2\/media\/275"}],"wp:attachment":[{"href":"https:\/\/webdevpuneet.com\/blog\/wp-json\/wp\/v2\/media?parent=274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webdevpuneet.com\/blog\/wp-json\/wp\/v2\/categories?post=274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webdevpuneet.com\/blog\/wp-json\/wp\/v2\/tags?post=274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}