Skip to content
GitHub (opens in a new tab)

HeaderCell

Column header for DataTable: label, optional select-all checkbox, optional sort, sm or md.

stableMoleculecontracts/headercell.json

Preview

HeaderCell

Column title for DataTable. Optional select-all checkbox. Cell is the body.

Master

A medium column title, framed so its edges read. Variants shows select all, sortable and number columns.

Name

Usage

Use in a th. DataTable already does. Body cells are Cell. Do not invent a local header.

Do's

  • DataTable column titles
  • DataGrid column titles
  • Select-all in the leading header column
  • Sortable DataTable column titles

Don'ts

  • Body cells — use Cell
  • A short static table — use Table
<HeaderCell size="md" label="Name" />

When to use

  • DataTable column titles
  • DataGrid column titles
  • Select-all in the leading header column
  • Sortable DataTable column titles

When not to use

  • Body cells — use Cell
  • A short static table — use Table

What an agent reads

import { HeaderCell } from "agentic-ds-kit";
must
  • Lives inside th scope=col
  • Checkbox unlabeled needs aria-label Select all {label} or Select all rows
  • When sortable, button with aria-label Sort {label} ascending/descending/Clear sort
  • When wrap, the whole wrapped label stays inside the sort button (one hit area, one focus ring)
defaults
  • size md
  • checkbox false
  • align start
  • sortable false
  • wrap false
stops if
  • Do not invent a local header cell or th cousin
  • Do not use Cell for headers
  • Do not use raw hex
  • Do not invent a SortButton or extra chevron component

From contracts/headercell.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
defaultCheckedbooleanNo—Uncontrolled initial state of the header checkbox (checkbox only). Use checked + onCheckedChange to control it.
labelstringNo—Column title. Omit for checkbox-only select-all.
sizesm | mdNomd—
checkboxbooleanNofalse—
checkedbooleanNo——
indeterminatebooleanNo——
onCheckedChangefunctionNo—(checked: boolean) => void
alignstart | end | centerNostartend for number columns. center for actionMenu columns.
idstringNo——
sortablebooleanNofalse—
sortasc | descNo—Active direction. Omit when unsorted.
onSortfunctionNo—() => void. DataTable cycles asc, desc, off.
wrapbooleanNofalseLabel wraps onto more lines; the sort icon stays on the line of the last word. DataTable sets it for columns with wrap. Without it the label stays on one line.
  • Component
    →

    Cell

    Inline cell content for datasets: text, link, avatar, file, payment, badge, trend, avatar group, select, progress, rating, or row actions, with optional checkbox.

  • Component
    →

    Table

    Simple semantic table for invoices, lists, and text rows, with optional sort, row menu, sticky header, loading, empty and error states, row dividers on or off, and one optional highlighted row.

  • Component
    →

    DataGrid

    An editable table: people click a cell to add or change its content, like rule conditions, line items, or mappings.

  • Component
    →

    DataTable

    Framed dataset with search, filters, column settings, and a caption title.