DataGridColumnHeader
Interactive column header for a DataGrid: click to cycle sorting, or open the
dropdown to sort, pin, move, and toggle column visibility. Reads DataGrid
context, so it must render inside a DataGrid provider.
Usage
import { DataGridColumnHeader, DataGridColumnHeaderProps } from "@desk/ui/components/data-grid-column-header";Best practices
Render inside a
DataGrid— it callsuseDataGrid()and throws outside the provider; use it as a column def'sheader, not standalone.The pin/move/visibility controls only appear when the matching
tableLayoutflags (columnsPinnable/columnsMovable/columnsVisibility) are enabled onDataGrid— a missing menu item usually means the flag is off, not a bug.Pass a human
title(and optionalicon); it is the accessible label for the sort/menu trigger and the moved-column announcement.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| column | Column<TData, TValue> | The TanStack Table column this header sorts, pins, moves, and toggles. | |
| filter | ReactNode | Filter control rendered at the top of the header dropdown menu. | |
| icon | ReactNode | ||
| pinnable | boolean | ||
| title | string | Header label text. | |
| visibility | boolean | false | Expose the column-visibility submenu in the header dropdown. |
Also exports
- interface
DataGridColumnHeaderProps
Composition
Builds on