Skip to content

Data Table Design Patterns for Dashboards, From Alignment to Loading

Data table design patterns for dashboards: alignment, sticky headers, sorting, bulk actions and loading states, with a live table you can break.

· · 12 min read
A data table with its header row and first column pinned, order and region on the left and right-aligned revenue

Most dashboard tables fail in the first ten seconds, and not because of the styling. Someone scrolls sideways, the order IDs vanish, and now they're staring at a column of numbers with no idea whose they are. Or they sort by revenue and the digits jiggle left and right like a bad slot machine.

This guide covers the table patterns that decide whether a dashboard is usable: alignment, pinned headers, sorting, selection, loading and the accessibility basics most teams skip. It sits next to our dashboard design patterns hub and the piece on data density, which already covers row height and virtualization, so I won't repeat those here.

TL;DR: Order columns by the task, right-align numbers and give them tabular digits, pin the header and the first column inside a scroll container with border-collapse: separate, put aria-sort on one header at a time, keep row actions to one or two, and pick the loading model by what the reader does with the rows. Skip any of these and the table still renders. It just stops being comparable.

A data table is a grid of records where each row is one thing and each column is one property of it. Its whole job is comparison: the reader needs to hold two rows in view and decide which one matters. Every pattern below either protects that comparison or gets out of its way.

What does a table have to do before it looks good?

Four things, according to Nielsen Norman Group's research on data tables: help people find records that meet some criteria, compare data, view or edit a single row, and take actions on records. That list is the best spec I know for a table, because every feature maps to one of the four. Filters serve finding. Pinned headers serve comparing. A side panel serves editing. Checkboxes serve acting.

The live table above uses most of them at once. It has a pinned header, a pinned first column that doubles as the row header, right-aligned tabular numbers, a sort indicator, checkbox selection and keyboard-reachable scrolling. Scroll it sideways and the order IDs stay put. Tick a row and the whole row tints without a line of JavaScript.

I built it as a single static <table> on purpose. A table that works as plain HTML before any framework touches it is a table you can reason about, and it's the version screen readers handle best.

How should columns be ordered and aligned?

Start with the identifier. NN/g's advice is to make the first column a readable record name, not an auto-generated database ID, because it's the label people use to keep their place. "A-1044 Halden & Sons" beats "7f3a91c2" every time. Then order the rest by importance and keep related columns adjacent: units next to revenue, revenue next to margin.

Alignment follows the data type, and it's the cheapest fix on this list:

  • Text aligns left, so the eye has a clean edge to scan down.
  • Numbers align right, so the ones, tens and hundreds line up in columns.
  • Headers match the alignment of their column. A left-aligned header over right-aligned numbers makes the column look broken even when it isn't.
  • Units go in the header ("Revenue (USD)"), not repeated in every cell.

Right alignment alone isn't enough, though. Most fonts give digits different widths, so a column of money still wobbles. I measured two numbers at 14px in Chromium with the default system font: "1,111.11" came out at 44.6px and "9,999.99" at 58.4px. Turn on tabular numerals and both measure 60.0px. That's a 13.8px swing from the digit 1 alone, and it's visible every time a live value updates.

Measured widths: 1,111.11 is 44.6 px and 9,999.99 is 58.4 px with default digits, both 60.0 px with tabular numerals
Measured in Chromium at 14px with the system font. Own graphic, Art of Styleframe.
Embed this graphic

Want this on your own site? Paste the code below. It keeps the credit and links back to this article.

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

Two declarations. If you only do one thing from this article, do that one. In the preview, delete the font-variant-numeric line and look at the Revenue column. The decimal points stay lined up because the text is right-aligned, but the thousands separators drift, and your eye stops trusting the column.

How do you pin the header and the first column?

With position: sticky, inside a container that scrolls. NN/g recommends freezing the header row and first column when the table is bigger than the screen, and CSS finally makes that a few lines of work.

.wrap { height: 236px; overflow: auto; }

table { border-collapse: separate; border-spacing: 0; }

thead th { position: sticky; top: 0; z-index: 2; }
tbody th { position: sticky; left: 0; z-index: 1; }
thead th:first-child { left: 0; z-index: 3; }
Diagram of a scrolling table: corner cell z-index 3, header row z-index 2, first column z-index 1
The corner cell has to win both ways, or the labels collide. Own graphic, Art of Styleframe.
Embed this graphic

Want this on your own site? Paste the code below. It keeps the credit and links back to this article.

That last rule is the one people forget. The corner cell is pinned on both axes, so it needs the highest z-index. Without it, the first column slides under the header while you scroll down, and the two labels overprint each other.

Then there's the border trap. I switched the preview to border-collapse: collapse and scrolled: the header's bottom border stayed behind with the rows, so the pinned header floated with no line under it and row text showed right up to its edge. Sticky cells don't carry collapsed borders with them. Use separate with border-spacing: 0, put borders on the cells, and the line travels with the header.

One more rule, and it's about backgrounds. Every pinned cell needs an opaque background. A transparent sticky header lets scrolling rows show through it, and no amount of z-index fixes that.

How should sorting and filtering behave?

Predictably, and with the semantics in the markup. The W3C's sortable table example is a good reference. The header text of each sortable column sits inside a real <button>, and the aria-sort attribute goes on the <th> of the one column currently sorted. When the sort changes, you remove it from the old header and set it on the new one. Values are ascending and descending.

<th scope="col" aria-sort="descending">
  <button type="button">Revenue (USD) <span aria-hidden="true">&darr;</span></button>
</th>

Notice the arrow. It lives in a span with aria-hidden="true", so it doesn't pollute the button's accessible name. The W3C example also puts the "click to sort" instruction in the table caption rather than repeating it on every button, which keeps a ten-column header from reading like a hostage negotiation.

For behaviour, three rules cover most dashboards. Sort on the first click, reverse on the second, and never silently reset the sort when new data arrives. Show active filters as removable chips above the table, so a reader never wonders why only 41 rows came back. And let people hide and reorder columns, but show a count of what's hidden. A table that quietly omits a column is lying by omission.

How do selection and row actions fit?

Selection first. A checkbox in the first column, a header checkbox for select-all, and the indeterminate state for "some rows". Tint selected rows so the choice survives a scroll. Since 2023 every major browser supports :has(), so this needs no script:

tr:has(input:checked) > * { background: #e6eeff; }

When something is selected, replace the filter bar with a bulk action bar ("3 selected: Export, Archive, Delete") instead of floating a toolbar over the rows. And tell people what select-all does. If the table has 1,284 rows and 20 are on screen, "Select all 20" and "Select all 1,284" are different promises, and the reader deserves to pick.

Row actions are where tables turn into hieroglyphics. NN/g suggests keeping inline row actions to one or two, because hidden menus are hard to discover. I agree, and I'd go further: if you need five actions per row, the problem isn't the table, it's that rows are doing the job of a detail page. Open a detail view instead.

A table is a promise that every row can be compared with every other row, so every layout choice either protects that comparison or breaks it.

Editing follows the same logic. NN/g's guidance is to edit in place only when the table is narrow, and to avoid modal dialogs for deeper edits because they hide the neighbouring rows. A non-modal side panel lets someone change a value and still see how the row compares with the rows above and below it. That's the comparison task again.

Pagination, load more, infinite scroll or virtual rows?

Pick by task, not by fashion.

Table tasks matched to loading models: find a record, scan hundreds of rows, browse a feed, act on many rows
The loading model follows the task. Own graphic, Art of Styleframe.
Embed this graphic

Want this on your own site? Paste the code below. It keeps the credit and links back to this article.

TaskBest fitWhy
Find one known recordSearch and filters, then paginationPages give a stable position and a count
Scan and compare hundreds of rowsVirtual scroll, fixed row heightOnly visible rows are in the DOM
Browse a feed with nothing to act onInfinite scrollNo footer to reach, no place to lose
Act on many rowsPagination or virtual scroll with "select all matching"Selection needs a defined set

Infinite scroll is the one I'd keep away from admin tables. It buries the footer, loses the reader's place on a refresh, and makes "select everything" ambiguous. Whatever model you choose, show the position: "41-60 of 1,284" is a small line of text that does more for orientation than any scrollbar. The density guide linked at the top covers how virtualization and row height depend on each other, so a density toggle should feed the same number to both.

What should loading, empty and error states look like?

Loading first, because that's where layout shifts hide. Render skeleton rows at the real row height, with the real column widths, so the table doesn't jump when data lands. A spinner in an empty box tells the reader nothing and collapses the layout underneath it.

.skeleton td { height: 36px; }
.skeleton td::after {
  content: "";
  display: block;
  height: 12px;
  border-radius: 6px;
  background: #e3e5ee;
}

Empty states have two causes, and they need different messages. "No orders yet" and "No orders match these filters" are not the same sentence, and the second needs a "Clear filters" button right there. Error states should keep the table frame and headers visible, say what failed, and offer a retry, so the reader keeps their context instead of landing on a blank page.

If a number is missing, say so. A dash is fine, a zero is a claim. "0.0%" margin and "no margin recorded" mean different things, and finance teams know it.

How do you keep a table accessible, and usable on a phone?

Start with the scroll container. A region that scrolls sideways has to be reachable by keyboard, and that's a real rule: axe-core's scrollable-region-focusable check fails when nothing inside a scrollable area can take focus. The fix from Deque is tabindex="0" on the container. I added that plus role="region" and an aria-label to the preview wrapper. Run against the preview as a standalone page, axe-core reported only the two page-level rules, no main landmark and no h1, both caused by testing a fragment, nothing from the table itself.

Next, keep the native <table>. Older write-ups from Adrian Roselli and Steve Faulkner reported that setting display: grid or flex on table elements strips their table semantics in the accessibility tree. A 2024 test by Zell Liew found most browser and screen reader pairs coped, though NVDA missed colspan. The sources disagree, which is the point: if you restyle a table into cards on small screens, you're gambling, and you'd have to re-add every ARIA role by hand to be safe. I'd rather keep the table and let it scroll.

Then touch. WCAG 2.2's target size rule asks for at least 24 by 24 CSS pixels on pointer targets, with a spacing exception. The 16px checkboxes in the preview miss that on size and pass through the exception, because neighbouring rows sit 36px apart. Squeeze rows toward 24px and the exception stops applying, so give the checkbox a bigger hit area before you do. Row action buttons need the same treatment.

On a phone, three habits cover almost everything. Keep the first column pinned. Cut the visible columns to the three that answer "which one is this and what's wrong with it". Everything else goes behind a row tap into a detail view. Contrast matters too, since zebra stripes and tinted rows shrink the margin for grey text, so check your tints against the rules in accessible tokens for design systems.

Which mistake costs the most?

Alignment. It's the least glamorous item here, and it's the one I'd fix first in any dashboard, because it affects every row of every table you ship. Pinned headers and clean sorting are the features people notice. Right-aligned tabular numbers are the ones they feel.

Do the cheap things in order: identifiers first, numbers right, header pinned, sort announced, filters visible. Reach for virtualization and column customisation only when a real table, with real data, demands it. If the same chart question keeps coming up while you build, choosing the right chart type is the next decision, and typography for data-dense interfaces covers the type side of everything above.

A dashboard table you can break
Edit the CSS

Delete font-variant-numeric from .num and compare the Revenue digits, then switch border-collapse to collapse and scroll to watch the header lose its bottom line.

Frequently Asked Questions

What is the best way to align columns in a data table?
Text left, numbers right, and headers matching their column. Right alignment lines up ones, tens and hundreds, so the eye can compare magnitudes without reading. Add font-variant-numeric: tabular-nums so every digit takes the same width, otherwise a live column still wobbles. In a test I ran, 1,111.11 and 9,999.99 measured 44.6px and 58.4px at 14px with the default digits and 60.0px each with tabular numerals. Put units in the header instead of every cell.
How do I make a table header sticky without breaking borders?
Put position: sticky; top: 0 on the th cells inside a scrolling container, and use border-collapse: separate with border-spacing: 0. With collapsed borders, the header's bottom line doesn't travel with the sticky cell, so it floats with no rule under it while rows scroll behind. Give every pinned cell an opaque background and a z-index, and give the top-left corner cell the highest one.
Should I use div grids or a real table element for dashboard data?
Use the table element whenever the content is tabular. It gives screen readers row and column navigation for free, and it works before any script runs. Reports disagree on whether display: grid on table parts strips semantics in current browsers, so restyling a table into cards is a gamble unless you re-add every ARIA role and test with a screen reader. Let a wide table scroll inside a focusable region instead.
When is infinite scroll a bad choice for a table?
Whenever rows carry actions, selection or a footer. Infinite scroll buries the footer, loses the reader's place on refresh and makes select all ambiguous, because nobody knows which rows that covers. Use pagination with a visible count like 41-60 of 1,284 for finding records, and virtual scroll with a fixed row height for scanning large sets. Keep infinite scroll for feeds where there is nothing to act on.
How should a sortable column be marked up for accessibility?
Wrap the header text in a real button inside the th, and set aria-sort to ascending or descending on the one column that is currently sorted, removing it from the previous one. Hide the arrow icon with aria-hidden so it stays out of the button name, and put the how-to-sort instruction in the table caption once instead of repeating it on every header.