ColumnManager
- Status
- Implemented
- Family
- 5 of 13
- Registry
- @lopifi/column-manager
npx shadcn@latest add @lopifi/theme @lopifi/column-managerThe component, rendering
Real data, the shipped component. Switch the theme to check the claims the spec makes below.
The four-layer spec
Show/hide/reorder with drag. Persisted per user per table. Drag uses FLIP + spring.snap; measure once at drag start, never during. Keyboard reorder via Cmd+arrows.
Lifted verbatim from Ledger & tables. The doc and this page are the same paragraphs, so they cannot disagree.
What lands in your repository
One component is never one file. Everything below is copied into your project, where you own it.
- Files
components/ledger/column-manager.tsx
- Lopifi dependencies · 2
- cnicons
- npm packages
- @base-ui-components/reactclsxtailwind-merge
- Registry entry
- /r/column-manager.json
The whole component
No compiled bundle, no black box. This is the file the registry copies, and the file you will edit.
"use client";
import { Popover } from "@base-ui-components/react/popover";
import * as React from "react";
import { cn } from "@/lib/ledger/cn";
import { EllipsisVerticalIcon, ViewColumnsIcon } from "@/components/ledger/icons";
export type ManagedColumn = { id: string; label: string; visible: boolean; locked?: boolean };
export interface ColumnManagerProps {
className?: string;
columns: ManagedColumn[];
onChange: (columns: ManagedColumn[]) => void;
}
/**
* Show / hide / reorder. Persisted per user per table. Keyboard reorder via
* Cmd+arrows, because drag alone is not an accessible reorder.
*/
export function ColumnManager({ columns, onChange, className }: ColumnManagerProps) {
const [dragIndex, setDragIndex] = React.useState<number | null>(null);
const move = (from: number, to: number) => {
if (to < 0 || to >= columns.length) return;
const next = [...columns];
const [item] = next.splice(from, 1);
next.splice(to, 0, item);
onChange(next);
};
return (
<Popover.Root>
<Popover.Trigger
className={cn(
"inline-flex h-8 items-center gap-2 rounded-sm border border-border bg-surface px-3 text-label font-medium",
"transition-colors duration-1 ease-standard hover:bg-surface-hover",
className,
)}
>
<ViewColumnsIcon aria-hidden="true" className="size-3.5" />
Columns
</Popover.Trigger>
<Popover.Portal>
<Popover.Positioner align="end" className="z-dropdown" sideOffset={8}>
<Popover.Popup
className="w-[260px] rounded-md border border-border bg-surface-raised p-2 shadow-elevation-3"
style={{ transformOrigin: "var(--transform-origin)" }}
>
<ul>
{columns.map((col, i) => (
<li
className="flex items-center gap-2 rounded-xs px-2 py-1.5 hover:bg-surface-hover"
draggable={!col.locked}
key={col.id}
onDragOver={(e) => e.preventDefault()}
onDragStart={() => setDragIndex(i)}
onDrop={() => {
if (dragIndex !== null) move(dragIndex, i);
setDragIndex(null);
}}
>
<EllipsisVerticalIcon
aria-hidden="true"
className={cn("size-3.5 text-text-tertiary", col.locked && "opacity-30")}
/>
<label className="flex flex-1 items-center gap-2 text-body">
<input
checked={col.visible}
className="size-4 accent-[var(--accent)]"
disabled={col.locked}
onChange={() =>
onChange(columns.map((c) => (c.id === col.id ? { ...c, visible: !c.visible } : c)))
}
type="checkbox"
/>
{col.label}
</label>
<button
aria-label={`Move ${col.label} up`}
className="text-caption text-text-tertiary hover:text-text-primary"
onClick={() => move(i, i - 1)}
onKeyDown={(e) => {
if (e.metaKey && e.key === "ArrowUp") move(i, i - 1);
if (e.metaKey && e.key === "ArrowDown") move(i, i + 1);
}}
type="button"
>
↑
</button>
<button
aria-label={`Move ${col.label} down`}
className="text-caption text-text-tertiary hover:text-text-primary"
onClick={() => move(i, i + 1)}
type="button"
>
↓
</button>
</li>
))}
</ul>
</Popover.Popup>
</Popover.Positioner>
</Popover.Portal>
</Popover.Root>
);
}
Also in Ledger & tables
- TransactionTableThe workhorse. Virtualized, sticky, priority-collapsing.
- TransactionRowDesktop row.Spec
- TransactionCardThe mobile re-rank.
- TransactionDetailFull detail sheet with attachments and audit trail.
- LedgerTableDouble-entry with debit/credit columns and a balance check.
- AgingTableAR/AP buckets, 0-30-60-90+.
- ReconciliationViewTwo-pane matcher. The match animation.
- CategoryPickerHierarchical with rule creation.
- FilterBarURL-param-backed filters with resolved-value chips.
- BulkActionBarSelection count + actions, safe-area aware.
- GroupPickerOne cut through a table, with subtotals per group.
- ExportMenuCSV/XLSX/PDF with a stated scope.
- TableColumnsSort and resize for a table that renders on the server.
- ColumnHeaderThe sortable, draggable header cell.
- PeriodGridThe ruled grid. Frozen panes, hidden columns, hover change, ⌘C.
See also
A component is specified in one place, defined in another, and running in a third. All three, from here.
- Ledger & tables — the family specThe four-layer specification this component was built against, before it was written.Doc
- Ledger tables and transaction registersThe family running, with real figures in it, in both themes and at every density.Live
- CatalogAll 179 components, specified before they are written.Doc
Elsewhere in the system
Where ColumnManager sits in the rest of the system — the live section it renders in, the calculators that compute what it displays, and the ledger payloads it is fed from.
- ColumnManager, runningThe tables showcase — live, with theme, density, greyscale and reduced-motion switches.Live
- Ledger & tablesThe table is the product. It gets the same design investment as the hero card. Specs for 15 React components: TransactionTable, TransactionRow, TransactionCard, TransactionDetail and 11 more.Doc
Components are copied into your repository and meant to be edited — rounding policy, fiscal calendar and compliance copy differ per company.
Told when Ledger & tables changes
Components are copied into your repo, so a fix here does not reach you on its own. One email when a component in this family changes in a way that needs a migration — and nothing when it does not.