Version 6.6.1 Released!

Click to checkout the new features

Blog

Data Table UI Design: 15 Best Practices With Code Examples

Published November 15, 2026

The mockup looks clean. Six columns, a few rows, a search box. Then real data arrives: 4,000 rows, a customer name that wraps onto three lines, a currency column nobody can scan, and a product manager asking why the table is blank while it loads. Most data table UI problems are not visual polish. They are decisions about alignment, density, state and behaviour that the mockup never had to make.

This guide collects the data table design best practices that matter once a table is in production, drawn from published design systems (IBM Carbon, Material Design, Atlassian) and UX research. Each practice comes with the code to build it. The examples use Tabulator, a free, MIT licensed JavaScript data grid, but the rules apply whatever you build with. If you are still choosing a library, start with our comparison of JavaScript table libraries.

The short version: a table UI design checklist

  1. Design for the job: scanning, comparing or acting on rows.
  2. Left-align text, right-align numbers, and align headers with their content.
  3. Use tabular figures and one format per column.
  4. Keep column headers to one or two words.
  5. Pick a row density on purpose, and let power users change it.
  6. Keep the header visible and freeze the identifying column.
  7. Choose a sensible default sort and show it.
  8. Put filters next to the data they filter.
  9. Design the empty, loading and error states.
  10. Show bulk actions only when rows are selected.
  11. Show totals and group related rows.
  12. Plan the small screen layout.
  13. Match inline editing to the stakes of the data.
  14. Choose pagination or virtual scrolling deliberately.
  15. Remember user preferences, and support the keyboard and screen readers.

The rest of the post explains each one, with screenshots and code.

1. Design for the job the table does

Every data table UI serves one of three jobs, and the job decides most of the design:

  • Look up a specific record (find invoice INV-1045). Search and a good default sort matter most.
  • Compare and monitor values across rows (which accounts are overdue). Alignment, number formatting, totals and status colours matter most.
  • Act on rows (approve, assign, delete). Selection, bulk actions and inline editing matter most.

Ask which job the spec describes before arguing about stripes or borders. A table built for lookup can be dense and plain. A table built for action needs clear selection states and room for controls.

2. Align text left, numbers right

This is the single biggest improvement you can make to most tables. Text reads left to right, so left-aligned text gives the eye a straight edge to scan. Numbers are compared by magnitude, so right-aligned numbers line up their units, tens and decimal points. Align each column header with its content, and never centre text in a data column.

Not every number is a quantity. Pencil & Paper's enterprise data table analysis notes that qualitative numbers like dates, postal codes, IDs and phone numbers can stay left-aligned. You never add up postcodes.

Invoice table with text columns left-aligned, quantities and currency right-aligned, and a totals row
Text left, quantities right, totals at the bottom. Built with Tabulator.
const table = new Tabulator("#invoices", {
  data: invoices,
  layout: "fitColumns",
  initialSort: [{ column: "date", dir: "desc" }],
  columns: [
    { title: "Invoice", field: "id" },
    { title: "Customer", field: "customer" },
    { title: "Issued", field: "date" },
    { title: "Status", field: "status" },
    { title: "Items", field: "items", hozAlign: "right", headerHozAlign: "right", bottomCalc: "sum" },
    {
      title: "Amount", field: "amount",
      hozAlign: "right", headerHozAlign: "right",
      formatter: "money", formatterParams: { symbol: "$", precision: 2 },
      bottomCalc: "sum", bottomCalcFormatter: "money",
      bottomCalcFormatterParams: { symbol: "$", precision: 2 },
    },
  ],
});

hozAlign aligns the cells and headerHozAlign aligns the header to match. See the money formatter and column calculations docs for the options used here.

3. Use tabular figures and one format per column

Right alignment only lines up digits when every digit is the same width. Many UI fonts use proportional figures by default, where a "1" is narrower than an "8", so a column of right-aligned numbers still looks ragged. One line of CSS fixes it:

.tabulator .tabulator-cell.num {
  font-variant-numeric: tabular-nums;
}

Apply the class with cssClass: "num" on numeric columns. Then pick one format per column and stick to it: the same number of decimal places, the same currency symbol, the same date format. A column that mixes 1,200, 1200.5 and $1.2k forces users to read every cell instead of scanning. Formatters keep the raw data untouched, so sorting and exporting still use the real values.

4. Keep column headers short

IBM's Carbon data table guidelines say column titles "should stick to one or two words", use sentence case, and wrap to two lines then truncate with the full text in a tooltip if they must be long. Long headers force wide columns, and wide columns push data off screen.

Move the qualifier into the header so cells stay short. Write "Amount (USD)" once in the header instead of "USD" in every cell. In Tabulator, headerWordWrap: true on a column lets a header wrap instead of truncating, and headerTooltip shows the full title on hover.

5. Choose a row density on purpose

Density is the trade between how many rows fit on screen and how easy each row is to read. Published design systems settle on a small set of sizes:

  • Carbon offers five row heights: 24, 32, 40 (default), 48 and 64 pixels, and says the header and toolbar should match the row size.
  • Pencil & Paper recommends three: condensed (40px), regular (48px) and relaxed (56px), with the density switch placed outside the table.
The same table at a compact 28 pixel row height and a relaxed 48 pixel row height
The same five rows at compact and relaxed density.

Analysts and operations teams who live in a table all day usually want compact rows. Occasional users and touch screens need taller rows. When in doubt, ship the middle option and add a density toggle. In Tabulator, row height is a single option, and vertAlign: "middle" keeps cell content centred in taller rows:

const table = new Tabulator("#orders", {
  rowHeight: 40, // fixed row height in pixels
  columns: [
    { title: "Customer", field: "customer", vertAlign: "middle" },
    // ...
  ],
});

Row separators are part of density too. Light horizontal dividers are the safe default. Zebra stripes help scanning across very wide rows, but they compete with hover and selected states, so test them with selection turned on.

6. Keep the header visible and freeze the key column

Once a user scrolls past the first screen, column headers are the only thing that tells them what a number means. Keep the header row fixed while the body scrolls. For wide tables, also freeze the column that identifies each row (usually a name or ID) so it stays visible during horizontal scrolling.

Wide customer table scrolled horizontally with the Customer column frozen on the left
Scrolled to the right, the Customer column stays put.

In Tabulator, giving the table a height (or maxHeight) makes the header sticky, because the body scrolls inside the table. Freezing a column is one property:

const table = new Tabulator("#accounts", {
  height: 480, // body scrolls, header stays visible
  columns: [
    { title: "Customer", field: "customer", frozen: true },
    { title: "Owner", field: "owner" },
    { title: "Region", field: "region" },
    // ...more columns
  ],
});

You can also freeze a column on the right (useful for totals or row actions) and freeze rows at the top with frozenRows. See frozen columns and rows.

7. Choose a sensible default sort and show it

A table that opens in database insertion order makes users do work the table should have done. Pick the default sort from the job: newest first for activity and invoices, most urgent first for queues, alphabetical for directories. Then make the current sort visible with an indicator on the sorted column, and make every sortable header obviously clickable.

Use the right comparison for each column type. Sorting dates as strings or numbers as text ("10" before "9") is one of the most common table bugs. Tabulator picks a sorter from the data, and you can set it explicitly with sorter: "number", "date" or "alphanum". Set the starting state with initialSort, and add headerSortTristate: true if users need a way back to the unsorted order.

8. Put filters next to the data they filter

Filters that live in a separate panel make users remember which column they are filtering. Header filters sit directly under each column title, so the filter and its result are in the same place. Use a text input for free text, a dropdown for columns with a few known values (status, region), and a range for numbers and dates. Add a global search box when users look up records by any field.

Show which filters are active and offer a one-click way to clear them. A table that silently hides rows is one of the fastest ways to lose a user's trust.

Try it: type in the Name filter below to filter this live Tabulator table. It also sorts, paginates and edits in place.

columns: [
  { title: "Customer", field: "customer", headerFilter: "input", headerFilterPlaceholder: "Search customers" },
  {
    title: "Status", field: "status",
    headerFilter: "list",
    headerFilterParams: { values: ["Paid", "Overdue", "Draft"], clearable: true },
  },
]

Our tutorial on filtering, sorting and searching a table in JavaScript covers custom filter functions, global search and server side filtering in detail.

9. Design the empty, loading and error states

Mockups always show a full table. Real tables spend a surprising amount of time empty, loading or broken, and each state needs its own message:

  • No data yet: explain what will appear and how to create the first item.
  • No results: say that filters are hiding rows and how to clear them. This is different from "no data", and users need to know which one they are looking at.
  • Loading: show progress inside the table area so the layout does not jump when data arrives.
  • Error: say what failed and offer a retry.
Table with active header filters showing a no results message that tells the user to clear filters
A filtered empty state that tells users why the table is empty.
const table = new Tabulator("#orders", {
  placeholder: "No orders yet. Create your first order to see it here.",
  placeholderHeaderFilter: "No orders match these filters. Clear filters to see all orders.",
  dataLoaderLoading: "<span class='spinner'></span> Loading orders...",
  dataLoaderError: "Could not load orders. Refresh to try again.",
  ajaxURL: "/api/orders",
});

placeholder also accepts a function, so you can build the message from the current filters. The Atlassian dynamic table docs, covered below, include worked examples of loading and empty states if you want a visual reference.

10. Show bulk actions only when rows are selected

Bulk actions (export, approve, delete) are noise until the user has selected something. Carbon's pattern is a batch action bar that replaces the toolbar at the top of the table once a row is selected, shows how many rows are selected, and disables single row actions while batch mode is active. Put the checkbox in its own narrow first column, and include a select all checkbox in the header.

Table with two selected rows highlighted and a bulk action bar showing 2 selected with Export, Mark paid and Delete buttons
A batch action bar that appears when rows are selected.
const table = new Tabulator("#invoices", {
  selectableRows: true,
  rowHeader: {
    formatter: "rowSelection", titleFormatter: "rowSelection",
    headerSort: false, resizable: false, frozen: true,
    hozAlign: "center", headerHozAlign: "center",
  },
  columns: [ /* ... */ ],
});

const bar = document.querySelector("#bulk-bar");

table.on("rowSelectionChanged", (data) => {
  bar.hidden = data.length === 0;
  bar.querySelector(".count").textContent = data.length + " selected";
});

Read the selected rows with table.getSelectedData() when an action button is clicked. A select all checkbox can be limited to the rows that match the current filter, which is usually what users expect. See the row selection docs.

11. Show totals and group related rows

If users export a table to a spreadsheet just to add up a column, the table is missing a feature. Put totals, averages or counts in a footer row, and keep it visible while the body scrolls. When rows fall into natural categories (status, team, month), group them under headers that show a count and a subtotal.

Invoice table grouped by status with group headers showing invoice counts and subtotals
Rows grouped by status, with a count and subtotal in each group header.
const table = new Tabulator("#invoices", {
  groupBy: "status",
  groupHeader: (value, count, data) => {
    const total = data.reduce((sum, row) => sum + row.amount, 0);
    return `${value} (${count} invoices, $${total.toLocaleString()})`;
  },
  columns: [ /* ... */ ],
});

Groups can start collapsed, nest several levels deep, and carry their own calculation rows. For parent and child records rather than categories, use a tree layout instead. Our JavaScript tree grid guide compares the options. For cross tab summaries (rows by columns), see pivot tables in JavaScript.

12. Plan the small screen layout

A twelve column table cannot fit on a phone, and shrinking it until the text is unreadable is not a plan. You have three honest options:

  • Horizontal scroll with a frozen identifying column. Simple, and fine for tables users only occasionally open on mobile.
  • Hide low priority columns as the screen narrows. Decide the priority order up front, with the product owner.
  • Collapse hidden columns into the row, so users can expand a row to see the fields that did not fit.
Narrow phone width table showing Customer and Amount columns, with expanded rows listing Status, Issued and Owner underneath
At phone width, lower priority columns move into an expandable row.
const table = new Tabulator("#invoices", {
  layout: "fitColumns",
  responsiveLayout: "collapse",
  rowHeader: { formatter: "responsiveCollapse", width: 36, headerSort: false, resizable: false },
  columns: [
    { title: "Customer", field: "customer", minWidth: 150, responsive: 0 }, // never hide
    { title: "Amount", field: "amount", minWidth: 110, responsive: 0 },
    { title: "Status", field: "status", minWidth: 100, responsive: 1 },
    { title: "Issued", field: "date", minWidth: 110, responsive: 2 },
    { title: "Owner", field: "owner", minWidth: 120, responsive: 3 }, // hidden first
  ],
});

Lower responsive numbers are more important. Use responsiveLayout: "hide" to drop columns without the expandable row. Details are in the responsive layout docs.

13. Match inline editing to the stakes

Inline editing (click a cell, change it, press Enter) is the lowest friction way to update data, and it keeps the user in context. It suits low risk fields: a name, a quantity, a status, a note. For high stakes changes, like a price, a payment or anything that triggers an email, add friction on purpose: edit in an expanded row, a side panel or a modal with an explicit Save button.

Whichever you choose, make editable cells look editable (a hover state or an edit icon), validate before saving, show when a save fails, and offer undo. Tabulator ships with built in editors for text, numbers, dates, lists and more, plus validation and an undo history. Our guide to building an editable table in JavaScript walks through the full pattern, including saving to a server.

14. Choose pagination or virtual scrolling deliberately

Both are valid. They suit different jobs:

  • Pagination suits lookup and action tables. Users can say "it's on page 3", the footer can show "1 to 20 of 4,312", and server side paging keeps responses small. Carbon places pagination at the bottom of the table, with a page size selector in its advanced variant.
  • Virtual scrolling suits monitoring and analysis tables, where users scroll and scan large sets. Only the visible rows exist in the DOM, so tens of thousands of rows stay smooth.

Avoid the worst of both: rendering every row with no virtualization, which works in the demo with 50 rows and freezes the browser with 50,000. Tabulator uses a virtual DOM by default when the table has a height, and pagination is one option:

const table = new Tabulator("#orders", {
  pagination: true,
  paginationSize: 20,
  paginationSizeSelector: [20, 50, 100],
  paginationCounter: "rows", // shows "Showing 1-20 of 4312 rows"
});

For a deeper look at rendering large datasets, see virtualized tables in React and our React pagination, sorting and filtering tutorial.

15. Remember preferences and support every user

If users can resize, reorder, hide, sort or filter columns, they will expect the table to remember those choices tomorrow. Losing a carefully arranged view on every page load is a common complaint about internal tools. Save the view, and give users a visible "reset to default" option.

const table = new Tabulator("#orders", {
  persistence: {
    sort: true,
    filter: true,
    headerFilter: true,
    columns: ["width", "visible"],
  },
  persistenceID: "orders-table", // separate saved views per table
});

Tabulator stores this in local storage by default, and you can swap in your own reader and writer to save views to a user account. See state persistence.

Accessibility belongs in the same conversation. A good table UI works with a keyboard and a screen reader, not only a mouse:

  • Use real header semantics so assistive technology can announce each cell with its column name. Tabulator marks up the grid with ARIA roles (grid, row, columnheader, gridcell) and exposes sort state with aria-sort. See the accessibility docs.
  • Do not rely on colour alone for status. Pair a coloured badge with a word, as in the screenshots above.
  • Support keyboard navigation between cells and keep focus visible. Tabulator includes configurable keybindings for moving between cells and pages.
  • Check contrast for header text, placeholder text and muted values. Light grey on white often fails.

Data table design references worth bookmarking

When a product owner asks "how should this behave?", these published design systems are good tie breakers. Each documents data table design decisions from teams who build data heavy products.

IBM Carbon: Data table

IBM Carbon Design System data table usage page

The most detailed public guidance on data table UI. It covers the five row sizes, toolbar and batch action rules, sorting indicators, header wording and pagination placement. If you need numbers to put in a spec, start here.

Material Design 2: Data tables

Material Design 2 data tables page with an interactive demo table and a right-aligned numeric column

Material's data table spec covers anatomy, row checkboxes, sorting and theming, with an interactive demo. Note the numeric column in the demo is right-aligned. Material 2 is no longer maintained, but the data table guidance is still a widely used reference.

Atlassian Design System: Dynamic table

Atlassian Design System dynamic table examples page

Atlassian's dynamic table docs are example led: sorting, loading states, empty states, pagination, drag and drop and highlighted rows, each as a live example. Useful when you need to show stakeholders what a state should look like.

Pencil & Paper: Data table design UX patterns

A long, practical article on enterprise data table UX: alignment, density, frozen columns, expandable rows, inline editing and bulk actions. It is one of the best single reads on table UX.

From design spec to working table

Most of the practices above are configuration, not custom code, if your table library supports them. Here is how the checklist maps to Tabulator options:

PracticeTabulator option
Align numbers righthozAlign, headerHozAlign
Consistent number formatsformatter: "money", "datetime", custom formatters
Short headers with tooltipsheaderWordWrap, headerTooltip
Row densityrowHeight, vertAlign
Sticky header, frozen columnsheight, frozen, frozenRows
Default sortinitialSort, sorter
Header filtersheaderFilter, headerFilterPlaceholder
Empty and loading statesplaceholder, placeholderHeaderFilter, dataLoaderLoading
Row selection and bulk actionsselectableRows, rowHeader, rowSelectionChanged
Totals and groupingbottomCalc, groupBy, groupHeader
Mobile layoutresponsiveLayout, responsive
Inline editingeditor, validator, history
Pagination or virtual scrollingpagination, paginationSize, virtual DOM (default)
Saved viewspersistence, persistenceID

Visual styling is separate from behaviour. Tabulator ships several themes (including Bootstrap, Bulma, Materialize and a minimal "simple" theme used in the screenshots in this post), and every element has a CSS class you can style to match your design system. It works in plain JavaScript and in React, Vue, Angular and Svelte apps.

FAQ

What are the best practices for data table UI design?

Left-align text and right-align numbers, keep headers short and visible, pick a deliberate row density, set a useful default sort, put filters next to their columns, design empty and loading states, show bulk actions only on selection, and plan how the table behaves on small screens.

Should numbers in a table be right-aligned?

Quantities (amounts, counts, percentages) should be right-aligned with tabular figures, so digits and decimal points line up for comparison. Numbers that are really labels, like IDs, postcodes and phone numbers, can stay left-aligned.

What row height should a data table use?

There is no single answer, but common sizes are 32 to 56 pixels. IBM Carbon defaults to 40 pixels and offers 24 to 64. Use compact rows for expert users scanning lots of data and taller rows for touch screens and occasional users, and consider a density toggle.

Is pagination or infinite scroll better for data tables?

Pagination suits tables where users look up or act on specific records and need a stable position. Virtual scrolling suits large datasets that users scan or analyse. Either way, avoid rendering every row into the DOM at once.

How do I make a data table responsive on mobile?

Either let it scroll horizontally with the identifying column frozen, hide low priority columns as the screen narrows, or collapse hidden columns into an expandable section under each row. Tabulator supports all three with frozen and responsiveLayout.

Is there a free library that implements these table UX patterns?

Yes. Tabulator is MIT licensed and includes header filters, frozen columns, row selection, grouping, column calculations, responsive layouts, persistence and virtual rendering with no paid tier. If you are weighing paid grids, see our AG Grid alternatives post.

Get started

Follow the quickstart to get a table on the page in a few minutes, browse the examples to see these patterns live, or read our roundup of the best JavaScript grid libraries. The source is on GitHub.