---
title: "GroupPicker"
description: "One cut through a table, with subtotals per group."
canonical: "https://lopifi.com/components/group-picker"
---

# GroupPicker

> One cut through a table, with subtotals per group.

Source: https://lopifi.com/components/group-picker
Part of: Lopifi — Your VC tech stack partner (https://lopifi.com)

---

- **Family:** Ledger & tables — 
- **Status:** Implemented
- **Spec:** https://lopifi.com/docs/catalog/ledger-tables

## Install

```bash
npx shadcn@latest add @lopifi/theme
npx shadcn@latest add @lopifi/group-picker
```

## Specification

Chooses how the table is cut. **One cut, not a stack.** Nested grouping (category inside entity
inside month) leaves about four data rows on screen under three levels of headers, and what it
really wants to be is a pivot table, a different tool with a different layout. One cut with a
subtotal per group answers the question people actually ask.

```tsx
<GroupPicker
  options={[
    { key: "category", label: "Category", hint: "Subtotal per account category" },
    { key: "vendor", label: "Vendor" },
  ]}
  value={groupBy}
  onValueChange={setGroupBy}
/>
```

- **"No grouping" is the first choice in the list** and where the tick starts, not a separate
  clear button. Ungrouped is a view like the others, and readers return to it constantly.
  `value={undefined}` means it; `noneLabel` renames it for the table.
- **The trigger says what's in force**: "Grouped by vendor", not "Group". If the label never
  changes, the reader has to open the control to find out.
- **Each option can say what its subtotal will mean** (`hint`), and the popover states the rule
  under the list: each group subtotals the rows under it, not the filtered set behind them.
- **The tick keeps its column** whether or not it's drawn, so labels don't shift as the
  selection moves. Choosing closes the popover; the popover opens from its trigger.

## Rules this component obeys

Money is minor units, never floats. `null` is not `0` and neither is redacted. Negatives render in accounting parentheses with the parenthesis column reserved on both sides. Debit and credit are two columns. Per-currency decimal places. Polarity is explicit — up is not always good. Every figure states its period, entity, currency, basis and as-of.
