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

Column Options

ProNew

Show, hide and reorder a table's columns from one panel, with a count of hidden columns on the trigger.

Installation

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

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
columns*{ id: string; label: string; locked?: boolean }[]

Every column, with its name. `locked` columns are always shown and cannot be switched off.

—
value*ColumnState[]

The columns in display order, each with whether it is shown.

—
onValueChange*(value: ColumnState[]) => void—
onReset() => void

Adds "Reset" to the panel.

—
labelstring

The trigger's label.

"Columns"
classNamestring—

Accessibility

  • Each column is a labelled switch; locked columns are disabled, not missing.
  • Reorder with a drag handle or with Up and Down on the handle; each move is announced.
  • The trigger states how many columns are hidden.