Theme studio

Design a theme, preview it live, then export it. Saved in this browser.

Quick picks #10b981
Generated scale
50100200300400500600700800900
Some text is below AA

TableHeaderCell

  • Stable
  • WCAG 2.2 evidence
  • RTL

A column header of a data table. A column with allowsSorting is sorted by click, Enter or Space; the header shows the sort icon (ArrowUpDown while unsorted, ArrowUp ascending, ArrowDown descending) and exposes aria-sort; the tables keeps arrow-key grid navigation between headers and cells (WCAG 1.3.1, 2.1.1, 4.1.2). The state is an icon and a darker label, not colour alone (1.4.1); keyboard focus draws the inset ring (2.4.7). Use it through TableHeader. Do not use it as a layout heading. Consumer duties: the column title wording, and announcing a sort result when the data changes (announceStatus, WCAG 4.1.3).

import { TableHeaderCell } from "@nexera-ui/react";
Loading example…
8
examples
16
props
3
live controls
1
platform
9
WCAG criteria
4
blocks use it

Try every prop. Copy the code.

Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.

Loading…
label
align
allowsSorting
Generated code
import { TableHeaderCell } from "@nexera-ui/react";

<TableHeaderCell />

Examples 7

The same examples as Storybook, rendered live. Open Code to copy one.

Sortable

Figma Sort=Sortable: allowsSorting. Click, or Tab to it and press Enter or Space; the direction comes from the table.

Loading example…

Sorted

Figma Sort=Ascending and Sort=Descending: set by the table's sortDescriptor. The label turns darker and the icon changes.

Loading example…

Aligned right

Figma Align=Right: for number columns. It means the end edge, so it flips in right-to-left layouts.

Loading example…

Select column

Figma Type=Select: the 48 px select-all column. The Table adds it for selectionMode="multiple".

Loading example…

Controlled sorting

Controlled sorting with sortDescriptor and onSortChange on the Table.

Loading example…

Long content

Long and translated titles wrap in the header; nothing is truncated.

Loading example…

Right to left

Right-to-left: the title sits at the start (right), and align="right" moves to the left edge.

Loading example…

Props 16

Press "Try it" on a card to load that prop into the playground.

16 props shown

labelNexera
ReactNode

Column title. It is the accessible name of the column and the text read for each cell ("Department: Engineering"). With type="select" it is only the visually hidden name of the column in a single-selection table (which has no select-all checkbox). Wraps instead of truncating.

Default –
typeNexera
"label" | "select"

label is a column title; select is the select-all column that holds the table's header checkbox. The Table wrapper adds the select column itself when the table is selectable.

Default label
alignNexera
"left" | "right"

Alignment of the title. right is for number columns and mirrors to the left in right-to-left layouts (it means the end edge). Set the same on the column's cells.

Default left
allowsSortingNexera
boolean

Whether clicking the header, or pressing Enter or Space on it, sorts by this column. The direction comes from the Table's sortDescriptor, and React Aria sets aria-sort on the header. Replaces the plan's sort enumeration, which would duplicate the table's own sort state.

Default false
textValueNexera
string

Plain text of the title, for the announcement of sorting and cell navigation. Defaults to label when it is a string.

Default –
selectAllLabelNexera
string

Name of the select-all checkbox (type="select"). Translate it.

Default Select all
classNameNexera
string

Extra classes for the header cell, merged last so they win over the defaults.

Default –
styleNexera
CSSProperties

Inline style for the header cell.

Default –
idReact Aria
Key

The unique id of the column.

Default –
isRowHeaderReact Aria
boolean

Whether a column is a [row header](https://www.w3.org/TR/wai-aria-1.1/#rowheader) and should be announced by assistive technology during row navigation.

Default –
widthReact Aria
ColumnSize | null

The width of the column. This prop only applies when the <Table> is wrapped in a <ResizableTableContainer>.

Default –
defaultWidthReact Aria
ColumnSize | null

The default width of the column. This prop only applies when the <Table> is wrapped in a <ResizableTableContainer>.

Default –
minWidthReact Aria
ColumnStaticSize | null

The minimum width of the column. This prop only applies when the <Table> is wrapped in a <ResizableTableContainer>.

Default –
maxWidthReact Aria
ColumnStaticSize | null

The maximum width of the column. This prop only applies when the <Table> is wrapped in a <ResizableTableContainer>.

Default –
focusModeReact Aria
"child" | "cell"

Whether the column header or its first focusable child element should be focused when the column header is focused. Defaults to 'child' in arrow keyboard navigation mode and 'cell' in tab keyboard navigation mode.

Default –
allowsArrowNavigationReact Aria
boolean

Whether the column should support arrow key navigation even when the containing table uses tab keyboard navigation. Allows users to navigate between columns and rows with arrow keys while focus is on an interactive child element within the column header.

Default –

* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.

Accessible by default.

Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.

WCAG 2.2 evidence

5 direct · 4 supporting
  • 1.1.1Non-text ContentLevel A · tested directly
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 1.4.1Use of ColorLevel A · tested directly
  • 1.4.4Resize TextLevel AA · supporting test
  • 1.4.11Non-text ContrastLevel AA · supporting test
  • 1.4.12Text SpacingLevel AA · supporting test
  • 2.1.1KeyboardLevel A · tested directly
  • 2.4.7Focus VisibleLevel AA · supporting test
  • 4.1.2Name, Role, ValueLevel A · tested directly

Fits any width.

Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.

0 px · drag the corner

Styling hooks

Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.

  • data-allows-sorting
  • data-hovered
Usage
<TableHeaderCell className="data-allows-sorting:opacity-90 shadow-sm" />

Used in blocks

Related components