Table
Rows of facts under named columns, one line per row, each cell fading at its end when its column runs short.
import { Table } from "@arcadia/ui"A table for reading: rows of facts under named columns, one line per row. Give each column a key and a label, and each row a key and its cells by column key. A string or a number in a cell is one line that fades at its end when its column runs short of room, never wrapping and never ending in dots; any other node is drawn as you pass it. There is no frame and no fill: a hairline between rows, and the header in the label ink.
Each column is as wide as its widest cell, so the table is no wider than what it holds. A column with tone="quiet" is drawn in the third ink, for what is read after the rest: an id, a handle, the ref above.
Examples
An empty column
With hideEmpty, the default, a column no row fills is left out, header and all: buttons and links have no value, so there is no Value column.
Turn it off to keep every column in place, as when rows arrive one by one and the columns should not move.
Numbers
align="end" sets a column at its end in tabular figures, so sizes and times line up by their digits.
Short of room
Each column is offered an equal share of the room.
One that needs less keeps its whole width, and the longer ones split the rest, each cell fading at its end. Narrow the room: the long value gives way first, then the name with it.
rootStyle takes where the table sits and these knobs, each a token of its kind: a cell's inline padding and a row's least height.
--table-px- Ref<Space>Default var(--space-2-5)
--table-row-h- Ref<Control>Default var(--control-md)
The table is built of divs with role="table", row, columnheader and cell, so a screen reader announces its rows and columns and reads each cell with its column's name. Name it with aria-label or aria-labelledby, as every example here does. A column hideEmpty leaves out is gone from the reading too, and a cell that fades is still read whole.
It is for reading: there is no sorting, no selection and no arrow-key movement between cells. A link or a button you put in a cell takes Tab like any other. A quiet column differs from the rest by its ink alone, so it should never be the only place a fact is said.