Columns
The column_spec array defines one entry per column.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
id |
string | required | The column’s id; HTML makes element ids from it |
align |
keyword | "left" |
"left", "center", "right", "justify" or "char" |
align_char |
string? | null |
The character "char" alignment lines the cells up on, "." when null (how) |
width |
length | "auto" |
The column’s width (below) |
min_width |
length? | null |
The least the column is wide |
max_width |
length? | null |
The most the column is wide |
style_id |
string? | null |
A style for the column’s body and summary cells (how styles combine) |
hidden |
boolean | false |
Leave the column out: its cells aren’t drawn, in any format |
label |
string? | null |
The column’s name, for producers and tools. No writer reads it (the column labels are the head’s cells) |
Example
{
"column_spec": [
{ "id": "col_0", "align": "left", "width": "150px", "hidden": false, "label": "Country" },
{ "id": "col_1", "align": "right", "width": "auto", "hidden": false, "label": "Population" },
{ "id": "col_2", "align": "center", "width": "1fr", "hidden": false, "label": "Region" }
]
}Width Values
| Value | Description |
|---|---|
auto |
Content-determined width |
120px |
Fixed pixel width |
25% |
Share of the table’s width |
1fr |
Share of what the other columns leave |
3cm |
Absolute length (cm, mm, in, pt) |
The table’s width is config.table_width when set, else the width of the line (the page’s text width, or the container’s). fr columns divide what the fixed and % columns leave, in proportion to their numbers (2fr is twice 1fr). When the table has a width and no column is fr, the auto columns share what the others leave, so the table is as wide as it says; a table whose columns all have fixed or % widths is as wide as they add up to. HTML leaves the sizing to the browser; how each other format sizes its columns is in Output Formats.
min_width and max_width take the same forms except fr and auto. Widths may not be negative; an invalid width fails validation with INVALID_LENGTH (see Validation).