Skip to main
Table of Contents

HTML Table

This page demonstrates production-ready table patterns with accessibility, responsive overflow handling, sorting, filtering, and export support.

  • Sticky header and frozen columns for wide datasets.
  • Interactive table with search, status filter, sorting, and export.
  • Scoped styles and scripts so demos do not leak into other page content.

Need sticky behavior fundamentals (stacked heading offsets and sticky mechanics)? HTML Sticky Element Fundamentals

Sticky Header and Frozen Columns

This example keeps the header visible while scrolling and freezes the first two columns to preserve row context on large tables.

Dataset Preview with Sticky Header and Frozen First Two Columns
RecordGroupCol 3Col 4Col 5Col 6Col 7Col 8Col 9Col 10Col 11Col 12Col 13Col 14Col 15
R-001Alpha13742265419052118637492863
R-002Alpha31624870198256297541613358
R-003Beta22883557447660189239542771
R-004Beta18662973528440258147683164
R-005Gamma27713369467851218736593066
R-006Gamma34644175388943247950552660
R-007Delta20802861498557159334623274
R-008Delta26683777428345238848583567
R-009Epsilon29723963538742178446653669
R-010Epsilon32673079478155209044572962
R-011Zeta24753466508648198342633368
R-012Zeta36614472408053278949563461
R-013Eta21842759558846169138673173
R-014Eta28693678438250228547603765
R-015Theta33654271457954248851583564
R-016Theta19833162579044149440663076
R-017Iota30703874418552268245623267
R-018Iota23772964548747189039692872
R-019Kappa35634576398156288750593663
R-020Kappa22823260588943159341682975

Code for This Render

This render is HTML markup plus shared sticky-table modifiers. No page JavaScript is required.

<div class="html-table-demo html-table-demo--freeze table-sticky table-sticky--freeze-two table-sticky--zebra table-sticky--center table-sticky--freeze-leading-left-2">
  <table class="content--sticky">
    <caption>Dataset Preview with Sticky Header and Frozen First Two Columns</caption>
    <thead>...</thead>
    <tbody>...</tbody>
  </table>
</div>
/* shared: asset/css/content/example/table-sticky.scss */
.table-sticky--freeze-two ... nth-child(1) { position: sticky; left: 0; }
.table-sticky--freeze-two ... nth-child(2) { position: sticky; left: var(--table-sticky-col1-width, 8.5rem); }
.table-sticky table.content--sticky thead th { position: sticky; top: var(--sticky-caption-height, 0); }

Interactive Orders Table (Search, Filter, Sort, Download)

This demo focuses on practical table UX. Search, filter, and sorting apply only to this table instance, and export actions only include visible rows.

For consistency and reliability, this demo exports JSON and CSV only.

Customer Orders
IDCustomerLocationOrder DateStatusAmount
1Eric avatarEricPurrfort17 Dec, 2022✅ Delivered$128.90
2Bearfoot avatarBearfootPaw Ridge27 Aug, 2023❌ Cancelled$5,350.50
3Dinner avatarDinnerFeastsburg14 Mar, 2023🚚 Shipped$210.40
4Sparkles avatarSparklesGlitterpaw25 May, 2023✅ Delivered$149.70
5Max avatarMaxClawvale23 Apr, 2023⏳ Pending$399.99
6Cleo avatarCleoPurropolis23 Apr, 2023❌ Cancelled$399.99
7Pepper avatarPepperSpiceburg28 Feb, 2023⏳ Pending$149.70
8Cheese avatarCheeseBrieville22 Dec, 2023❌ Cancelled$249.99
10Luna avatarLunaMoonpaw11 Jan, 2024⏳ Pending$640.00
11Nori avatarNoriHarbor Cliffs18 Jan, 2024🚚 Shipped$315.25
12Otis avatarOtisTabby Point23 Jan, 2024❌ Cancelled$72.10
13Piper avatarPiperPawston02 Feb, 2024✅ Delivered$1,200.00
9Kiki avatarKikiWhisker Bay06 Jan, 2024✅ Delivered$89.50
14Quill avatarQuillInk Alley08 Feb, 2024⏳ Pending$58.75
15Rivet avatarRivetGear Hollow14 Feb, 2024🚚 Shipped$402.00
16Saffron avatarSaffronSunridge20 Feb, 2024✅ Delivered$980.90

Code for This Render

Keep the markup small and let the page script handle search, filter, sort, summary, and CSV/JSON export.

<div class="html-table-toolbar">...controls...</div>

<div id="orders-table" class="html-table-demo html-table-demo--orders table-sticky table-sticky--zebra table-sticky--orders-layout">
  <table class="content--sticky">
    <caption><span class="font-icon--example-html-table--cart"></span> Customer Orders</caption>
    <thead>...</thead>
    <tbody>
      <tr data-id="1" data-customer="Eric" data-status="delivered" data-amount="128.90">...</tr>
    </tbody>
  </table>
</div>
/* asset/js/content/example/html-table.js */
// Reads row data-* attributes, then:
// - filters by search/status
// - sorts rows
// - updates visible-row summary
// - exports visible rows to JSON or CSV

Files for These Renders

  • Page HTML: in/example/html-table.html
  • Shared sticky table SCSS: in/asset/css/content/example/table-sticky.scss
  • Page SCSS (wrappers/toolbar/status): in/asset/css/content/example/html-table.scss
  • Page JS (interactive orders demo): in/asset/js/content/example/html-table.js

Attribution

This page includes adapted ideas and patterns from the following sources: