Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Column Header

ProNew

A column heading that opens a menu to sort either way, clear the sort, pin the column or hide it.

Installation

pnpm dlx shadcn@latest add @viewport/column-header

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
title*string

The column's name.

—
sort"asc" | "desc" | null

The column's current sort.

null
onSort(sort: "asc" | "desc" | null) => void

Receives the chosen sort, or `null` to clear it. Leave it out for columns that cannot be sorted.

—
onHide() => void

Adds "Hide column".

—
pinnedboolean

Whether the column is pinned. Pass it with `onPin` to add "Pin column".

—
onPin(pinned: boolean) => void—
numericboolean

Align the trigger to the end, for numeric columns.

—
classNamestring—

Accessibility

  • The trigger names the column and states its current sort.
  • A Radix Dropdown Menu: arrow keys, typeahead and Escape.
  • The arrow turns between ascending and descending only when motion is allowed.