Faragiri
English

Choose a language 2

Learn Tables and lists Components

A Felixstowe container list where the two fields a quay needs were columns one and seven, and staff photographed the screen twice to compare.

6Sections
4Min read
4Depth

Recommended Before This

0 / 2

A table is for comparing down a column and a list is for finding one item. That is the whole choice, it is about what the reader is doing rather than about how much data there is, and getting it wrong produces a table nobody reads across or a list nobody can compare.

Ewa is rebuilding the container list for a port operator in Felixstowe. Nine fields per container, four hundred rows on a busy morning, read on a desktop in an office and on a phone standing on a quay.

The column budget

Eight columns at 1180, six at 900, four at 600. Those are not arbitrary: a column needs enough width for its longest realistic value plus its heading, and once the widths are added up the count falls out of the space.

Nine fields, four hundred rows

How many columns fit, and where the table stops being one

The count falls out of the widths rather than out of a preference, and the last step is a different component entirely.

columns shown, against the viewport width in pixels

  1. 81180
  2. 6900
  3. 4600
  4. 2Below 600

The last step is not a two-column table, it is a card carrying the container number and the bay with a link to the other seven fields.

Modular Type Scale & CSS Flex/Grid Motion Lab

Test harmonic typography ratios and live Flexbox/Grid layouts with 1-click CSS export.

Below 600 a table becomes a list of cards, not a horizontal scroll. A horizontal scroll on a phone is a table that has been given up on: the first column is the only one visible, every lookup is a swipe right and back, and the reader loses their row on the way.

The card carries the two fields people scan for and a link to the rest. On this list that is the container number and the bay, which are columns one and seven of the desktop table, and putting them together is the entire mobile design.

Rows, headers and rules

Rows are 40 px comfortable and 32 compact. Both exist because a compact mode is a requirement for anybody who works in it all day: the office staff want thirty rows on screen, and the person on the quay wants a target they can hit in a glove.

Legibility under load

Density targets, sticky budget, and fifth-row rules that protect contrast

Four hundred rows worked all day demand deliberate heights, a single thin header, and unshaded backgrounds.

Rows, headers, and rules

  1. Yes40 px comfortable row heightGives quay workers a target they can tap in a gloveYes
  2. Yes32 compact row heightLets office staff scan thirty rows on screen at onceYes
  3. YesOne sticky header under a tenth of viewportKeeps column labels visible without squeezing dataYes
  4. YesSubtle divider rule every fifth rowGuides the eye across columns without dimming textYes
  5. NoZebra striping on alternate rowsHalves contrast on half the rows in the tableNo
  6. NoStacked sticky toolbars and tab barsEats a third of the screen and leaves a letterboxNo

Zebra striping is a common reflex that quietly breaks the contrast ratio measured on white rows.

The sticky header is one row and never more than a tenth of the viewport. Two sticky rows, or a sticky header plus a sticky toolbar plus a sticky tab bar, is a screen where a third of the height is furniture and the data scrolls through a letterbox.

A rule every fifth row beats a zebra stripe, which halves the contrast of half the rows. Striping is the reflex and it costs something measurable: every second row now has its text on a tinted ground, so half the table is at a lower ratio than the designer measured on the white one.

Sorting without losing anybody

State the default sort above the table. A four hundred row list that arrives in some order is a list whose order is a mystery, and the reader will assume it is meaningful and be wrong.

Order and orientation

Three steps so sorting never disorients the reader

Reordering four hundred rows moves everything under the reader's eyes unless state and position are preserved.

  1. 01State the default sort above the tablePrevents readers from guessing a mystery order on arrival
  2. 02Announce the active sort clearlyConfirms which column and direction currently govern the list
  3. 03Keep the selected row in view after sortingStops the reader from losing their container when rows jump

Holding scroll focus on the selected row turns sorting from a disorienting jump into a usable tool.

Then announce the current sort, and do not lose the reader's position when it changes. Sorting is the one interaction on a table that moves everything, and a reader who was looking at a row is now looking at a different row in the same place. Keeping the selected row visible after a sort is a small piece of work and it is the difference between sorting being useful and being something people avoid.

What to open

The HTML table element, with a caption and scope on its headers, is the tool, part of the language and free. It replaces a grid of divs, which looks identical, announces as nothing, and cannot be navigated cell by cell by anybody using a screen reader. A real table gives the row and column headers with every cell for free.

What to open

Native table markup and CSS sticky headers replace brittle scripts

Built-in HTML and CSS give screen-reader navigation and drift-free headers without cloned JavaScript rows.

  1. 01Native table structure
  2. 02Row and column header associations
  3. 03Pinned header row in pure CSS
  1. 01HTML table with captionReplaces div grids that look identical yet announce nothing
  2. 02Header scope attributeReads the column and row labels automatically with every cell
  3. 03CSS position stickyReplaces cloned script headers that drift a pixel on scroll

Cloned header tables also fall out of sync whenever a column width changes.

Position sticky handles the header, part of the language and free, and it replaced a second cloned header row positioned by script, which drifts by a pixel on every scroll and has to be kept in step with the real one whenever a column width changes.

Where it stalls: nobody decided about the phone

A table is designed at desktop width, because that is where a table makes sense and that is the artboard. The phone question is left to the implementation, and the implementation does the only thing a table can do in a narrow box, which is scroll sideways.

Where desktop reviews fail

Horizontal scroll happens when nobody decides what a phone should show

Left out of desktop design reviews, the narrow viewport defaults to sideways scrolling until someone asks quay staff.

Horizontal scrolling is not a design choice; it is the absence of one.

A horizontal scroll is what a table does when nobody decided what a phone should show. It is not a design decision, it is the absence of one, and it is invisible in review because the review happens at desktop width.

The decision that was skipped is small: which two fields does somebody scanning on a phone actually need. On this list it took one conversation with two quay staff and about four minutes.

What it looks like when it goes wrong

The port's list scrolled horizontally on phones for three years. The container number was column one and the bay was column seven, so finding where a box was meant swiping right past five columns nobody on a quay needed, reading the bay, and swiping back to confirm the row. Staff had worked out that turning the phone to landscape got them to column five, and the standard practice on the quay was to photograph the screen twice and compare the two pictures.

Three years on the quay

How staff read container and bay across seven sideways columns

With container number in column one and bay in column seven, workers invented a two-photo workaround.

  1. 01Find container in column oneSwipe right past five columns nobody on the quay needs
  2. 02Rotate phone to landscapeReaches column five, still short of bay in column seven
  3. 03Photograph the screen twiceCompare two separate pictures side by side to match one row
  4. 04Switch below 600 px to two-field cardPut container number and bay together with a link to all nine fields

Once a real two-field card exists, nobody has to swipe back to confirm they stayed on the same row.

The same data in a document that gets read rather than operated has different rules, and those are dense information made navigable. Every number in a column that updates in place needs a setting most tables do not have, which is sizes, weights and a readable scale. And where eight columns become six is a width decision that should have evidence behind it, which is where the layout changes, and why there. How a table is held as a component rather than as a screen is one level up, in the parts an interface is assembled from.

Alongside this

Above this