CentercodeDitto
DittoPorygonAPI

ColumnPicker

Multi-select columns with drag-and-drop reordering

Overview

ColumnPicker allows users to select which columns to display in a data table. Columns are organized by category with optional icons. When reordering is enabled, selected columns can be rearranged via drag-and-drop. Ideal for customizable table views in the Universal Data Engine.

Key Features

  • Grouped column selection by category
  • Search filtering across all columns
  • Drag-and-drop reordering of selected columns
  • Visual feedback with category icons
  • Accessible checkbox-based selection
  • Column descriptions on hover

Interactive Examples

Basic Usage

Click a column to toggle selection. Columns are grouped by category.

Selected: None

Pre-selected Columns

Selected columns are highlighted. Use the search to filter available columns.

Name
Email
Status

Selected: user.name, user.email, membership.status

With Drag & Drop Reordering

Drag selected columns to reorder them. Order is preserved when columns are toggled.

Name
Email
Role
Completion Rate

Order: user.name → user.email → membership.role → metrics.completionRate

Disabled State

When disabled, columns cannot be selected or reordered.

Name
Email

Interfaces

ColumnGroup

PropTypeDescription
idstringUnique identifier for the group
namestringDisplay name for the group header
iconIconDefinition?Optional icon for the group header
fieldsColumnField[]Array of column fields within this group

ColumnField

PropTypeDescription
idstringUnique identifier for the column
pathstringData path for the column (e.g., "user.name")
labelstringDisplay label for the column
fieldTypestringField type (TEXT, NUMBER, DATE, etc.)
categorystringCategory the column belongs to
descriptionstring?Optional description shown on hover

Props Reference

PropTypeDefaultDescription
groupsColumnGroup[]requiredArray of column groups containing fields
selectedstring[]requiredArray of currently selected column paths
onChange(selected: string[]) => voidrequiredCallback when selection changes
allowReorderbooleanfalseEnable drag-and-drop reordering
placeholderstring-Search placeholder text
disabledbooleanfalseDisable all interactions
classNamestring-Additional CSS classes

Usage

import { ColumnPicker, type ColumnGroup } from '@/ui/components';
import { faUser, faCalendar } from '@fortawesome/duotone-regular-svg-icons';

// Define column groups
const groups: ColumnGroup[] = [
  {
    id: 'account',
    name: 'Account',
    icon: faUser,
    fields: [
      { id: 'name', path: 'user.name', label: 'Name', fieldType: 'TEXT', category: 'account' },
      { id: 'email', path: 'user.email', label: 'Email', fieldType: 'EMAIL', category: 'account' },
    ],
  },
  {
    id: 'membership',
    name: 'Membership',
    icon: faCalendar,
    fields: [
      { id: 'joinedAt', path: 'membership.joinedAt', label: 'Joined Date', fieldType: 'DATE', category: 'membership' },
    ],
  },
];

// Usage in component
const [selected, setSelected] = useState<string[]>(['user.name', 'user.email']);

<ColumnPicker
  groups={groups}
  selected={selected}
  onChange={setSelected}
  allowReorder
/>