01
Overview
th cell within a table header row, supporting sort indicators and column labels.
Usage
TableHeaderCell is a compose-only leaf of Table. The idiomatic API is Table.HeaderCell, reached through the parent namespace — see the table README for the composed snippet. The leaf is also a named export of @lostgradient/cinder.
Set hideBelow to hide a column below its table container's width threshold in table form. Set showOnly to limit it to the table or stacked form. A stacked field takes its label from the header, and Table stacks at its usual breakpoint.
02
When to use
Use when
- Labeling a column inside a table-header row.
- Making a column user-sortable by setting the sortable prop and supplying a column identifier.
- Sizing a fit table's column: sizing="content" for a short value such as a badge, sizing="fill" for prose.
- Hiding columns by container width with hideBelow or by form with showOnly. Table stacks at its usual breakpoint.
Avoid when
- Rendering a body data cell — use table-cell instead.
03
Props
Name | Type | Default | Description |
|---|---|---|---|
column | text | Column key. Required when sortable=true so the parent Table can
track which column the user activated. | |
sortable | boolean | false | When true, render a button inside the <th> and dispatch sort intents
to the parent Table. The cell's aria-sort reflects the current sort
direction (ascending, descending, or none). |
scope | 'col' | 'colgroup' | 'col' | When set, hint to assistive tech that the column groups multiple rows. |
align | 'left' | 'center' | 'right' | 'left' | Horizontal alignment for the header cell content. Defaults to 'left'. |
sizing | 'content' | 'fill' | How this column takes its width in a fit table. 'content' is for a short value (a status
word, a badge, an identifier, a count): the column is as wide as its widest header or cell,
never wider than half the table (28rem for a table drawn with scrollable={false}, which has
no scroll box to measure), and its cells do not wrap; a longer value ends in an ellipsis
with the whole value in a tooltip. 'fill' is for prose: the column takes the width the
content columns leave and wraps, its text running the full width of the column. Left out, a column shares the width
equally with the others, as every column of a fit table with no sizing does. It has no
effect outside a fit table, or while the table is stacked. | |
hideBelow | 'sm' | 'md' | 'lg' | Hide the column in the table form below its container's width threshold. Use sm for 40rem,
md for 56rem and lg for 72rem. The field remains in stacked rows. | |
showOnly | 'table' | 'stacked' | Show the column only in the named form. A stacked-only field uses this header's label. Leave unset to show the column in both forms. The table stacks at its usual breakpoint. | |
label required | text | The column's name as text, printed beside each value while the table is stacked. It is in the
server's HTML, so the first paint of a stacked table already carries every label (COR-2771).
Usually the header's own text; '' for a column with no name (a selection column). Required:
a header cell cannot tell whether its table can stack, and a table may gain fit later. | |
children required | snippet | Cell content (column label). | |
actions | snippet | Optional controls rendered beside, but outside, the sortable button. |