Data
FilterBuilder
Questions about a list, such as category is Groceries and amount over $50, each one an applied FilterPill you can edit or remove. + Filter asks for the field, then the condition and the value, with the control that fits the type: rows or a Combobox for options, an Input for text, a MoneyInput, a Calendar, yes or no. Keep the filters in the URL with serializeFilters and parseFilters. The URL is input, so parseFilters drops anything that does not match a field.
Preview
?filter=category%3Ais%3Ahome
2 of 7 entries
- renthome · 2026-09-26−$1,800.00
- grocerieshome · 2026-09-25−$123.80
Installation
// Resolves dependencies, copies the source, and installs npm packages automatically.
Usage
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| fields | { id, label, type, options?, currency?, icon? }[] | - | type is "enum", "text", "amount", "date" or "boolean". An id is letters, digits, - and _ |
| value | { field, op, value }[] | - | Amounts in minor units, days as YYYY-MM-DD |
| onValueChange | (filters) => void | - | Every add, edit and removal |
| labels | Partial<labels> | - | Every word, the conditions under labels.ops |
| serializeFilters(filters) | string[] | - | One field:op:value string each, for params.append |
| parseFilters(values, fields) | Filter[] | - | Back from the URL. Drops unknown fields, wrong conditions, bad values and repeats |
| matchesFilter(value, filter) | boolean | - | For lists filtered in the browser. Text ignores case and accents |