Skip to content

Table

beta

A data table with sorting, row selection, loading and empty states, and custom cells. It can virtualize long lists.

Content · TaishoDS Core, in plain HTML.

Examples

One working example per case. Each example is the HTML of its preview—copy it as is, and with Core’s CSS and JS loaded, it looks and works the same.

Table sortable by column

Name Plan Age
Beto Pro 30
Ana Free 9
Cami Pro 41
html

Formatted numbers

Project Requests per month
Dashboard 18,500
Payments API 126,000
Marketing site 4,100
Mobile app 920
html

When to use

  • The data is uniform and compared row by row, with the same columns for every record.
  • You need to sort, select, or scan many records.
  • The list is long, and virtualizing it beats paginating it.

When not to use

  • Each item is different and reads as a unit → card.
  • You’re building a layout grid, not showing data → grid.
  • There’s no data to show. That case is an empty-state.

Do

  • Define the loading and empty states. A blank table explains nothing.
  • Right-align numbers, and keep column widths stable when sorting.

Don’t

  • Don’t use it for layout. That’s what grid and stack are for.
  • Don’t add twenty columns. If they don’t fit, prioritize and leave the details for another view.

TaishoDS Core

Needs Core’s JS, which handles focus, keyboard, and state.

Sorts rows and virtualizes them by window.

Core hooks into it through these attributes. They go in the markup, and there’s nothing to initialize.

  • data-ts-cell
  • data-ts-key
  • data-ts-row
  • data-ts-sort-value
  • data-ts-table
  • data-ts-table-body
  • data-ts-th

What it does: Sorting and virtualization (it measures the viewport, computes the visible window, and recycles rows). Sorting always starts from the original row order, so when you switch columns, ties keep their initial order instead of the previous sort’s. Sorting is local: it only moves the rows in the DOM, so in a paginated table it doesn’t reach the other pages.

Attribute What it does
ts:changeFires when a sortable header is activated, before the rows move. Carries detail.component ("table"), detail.key (the column’s data-ts-key), and detail.direction ("asc" or "desc"). It’s cancelable: if you stop it, the rows stay put, but the table still records the column and direction (data-ts-sort-key, data-ts-sort-dir, and aria-sort), so the next click computes the right direction.
data-ts-sort-key, data-ts-sort-dirOn the root. The column and direction of the current sort. If the table arrives already sorted, write them in the HTML, along with aria-sort and is-sorted on its <th>. The first click on that column reverses the order.
data-ts-sort-valueOn the <td>. The value the row is sorted by, in place of the cell’s text. It’s read as a number when it is one (with a dot for decimals and no separators: 1850), otherwise as text. Use it when what’s shown isn’t what should be compared: a formatted number (1,850, ١٬٨٥٠), a currency, a date (2026-11-07), or a unit (410 hm³).
langWithout data-ts-sort-value, the cell’s text is read as a number in the language of the nearest lang: in es, “1.850” is 1850 and “1,5” is 1.5; in en, “1,850” is 1850; in ar, “١٬٨٥٠” is 1850. It only recognizes an integer, with or without thousands in groups of three, and the language’s decimal mark. Anything else (currencies, units) sorts as text.

From the CDN, without a build, load taisho.table.css along with taisho.base.css. Also load:

  • taisho.checkbox.css
  • taisho.empty-state.css
  • taisho.icon.css
  • taisho.skeleton.css

For how Core works in general, see Behavior.

Sort on the server

If the table shows one page of a longer list, cancel ts:change and ask your server for the rows already sorted. The header shows the new order as soon as you click, so if the request fails, report the error and offer a retry.

html

Accessibility

Implements the Table pattern from the WAI-ARIA APG.

  • Semantic <table>/<th>/<td> structure. The sort order is reflected in aria-sort. When you sort by another column, ties keep the original row order, not the previous sort’s, so the order a screen reader announces is predictable.
  • The wrapper has overflow-x-auto, so on small screens the table scrolls without breaking the layout.

Keyboard

On top of what the browser already does (Tab moves focus, Enter activates a button).

Key What it does
Enter/SpaceOn a sortable header, sorts by that column (ascending, descending). The header is a <th tabindex="0"> with aria-sort and no <button> inside.

Verification

What was actually tested. Anything that wasn’t tested says so—we’d rather say “not verified” than claim too much.

  • axe WCAG 2.2 A + AA in a real browser, in light and dark mode, before every release.
  • keyboard Key map documented above, checked against the component.
  • screen reader Not verified with a screen reader. Test it in your own combination of components, not just here, where each one appears alone and on its happy path.