Content
- The label is the column name: one or two words, sentence case.
describeuses plain words people would say: "newest first", "highest first", never "ascending".
A table column header that sorts its rows.
import { … } from "@brdgapp/ui/components/column-sort-button"ColumnSortButton is a table column header you click to sort by that column. It shows the column's icon and name, with a faint double arrow when it isn't the sort and a blue arrow pointing the current way when it is. It only shows the state: the code that owns the rows decides what each click does.
Icon. The column's icon, 14px, muted.
Label. 12px Bold.
Arrow. ⇅ faint when not sorted; ↓ or ↑ in blue when sorted.
Click to sort; click again to flip.
| Rest | Hover | Focus | |
|---|---|---|---|
| Not the sort | |||
| Sorted, newest first | |||
| Sorted, oldest first |
| State | What happens |
|---|---|
| Not the sort | Secondary label, faint double arrow. |
| Sorted | Dark label, blue arrow in the current direction. |
| Hover | Light fill. |
Do
Describe directions in words: "newest first".Don't
Leave screen readers with "ascending".describe uses plain words people would say: "newest first", "highest first", never "ascending".describe to get it.| Keys | Action |
|---|---|
| EnterSpace | Sort by this column, or flip the direction. |
ColumnSortButton
The sortable header.
| Prop | Type | Default | Description |
|---|---|---|---|
icon | LucideIcon | — | The column's icon component (not an element). |
label | string | — | The column name. |
tooltip | string | — | Explains the column. |
direction | "asc" | "desc" | null | — | This column's sort, or null. |
describe | { asc: string; desc: string } | — | Words for each direction. |
onClick | () => void | — | Change the sort. |
…other attributes | id, aria-*, data-*, event handlers | — | Passed to the button. The component's own props win where they overlap. |
What it's built from and where it's used, read from the code. When you change it, check these too.
components.md → ColumnSortButton; src/components/ui/column-sort-button.tsx.