Skip to content

TableColumn

Defined in: components/table.ts:8

One column of a table.

T

optional label?: Slot

Defined in: components/table.ts:10

The column’s heading.


optional field?: keyof T & string

Defined in: components/table.ts:19

The field of the row this column shows. Without a cell, the cell is this field’s value, as text.

The user sorts on it by tapping the column’s heading: once from low to high, again the other way around. A list that is loaded has that for the fields, and the ways around, it has a loader for.


optional cell?: (row) => string | number | void

Defined in: components/table.ts:26

Draws the row’s cell in this column. Return a string or number to have it shown as plain text, or draw anything you like into the cell and return nothing. It runs in a reactive scope of its own, so a change to what it reads redraws this one cell. Defaults to showing the field.

T

string | number | void


optional group?: boolean | ((row) => string | number)

Defined in: components/table.ts:34

Groups the rows while they are sorted on this column’s field: a heading row naming the group comes before its first row. true groups rows by the field’s value; a function returns the name of a row’s group — the month of its date, say.


optional align?: "center" | "start" | "end"

Defined in: components/table.ts:39

Which side the cell’s content keeps to. "end" is the one for numbers: they line up on their last digit, as every figure in a table is tabular.


optional width?: string

Defined in: components/table.ts:45

The column’s width, as a CSS grid track: "8rem", "2fr", "auto" (as wide as the widest cell drawn). Defaults to an equal share of the width, "minmax(0, 1fr)". Text that doesn’t fit ends in an ellipsis.