Expenses filters
The expenses list's controls: the work-queue views (Needs attention, To approve, Missing receipts, All spend), whose spend, a date range, once there is more than one card, the card, and a removable "Merchant: name" chip while the list is narrowed to one merchant.
Component: A piece you place inside your own screens: a table, a form, a card or a dialog. You decide the layout around it. Pages vs components
Ready to connect to Dolfin. Loads data through SDK hooks, with appearance and behaviour you can customise. Requires DolfinProvider.
Installation
Needs the Dolfin registry token. The CLI copies the source into your app.
bunx --bun shadcn@4.23.0 add @dolfin/expenses-filtersAlso installs: button, input, select, tabs, base-theme, expenses-spender-filter, ui-expenses-filters.
Usage
import { ExpensesFilters } from "@/components/dolfin/expenses/expenses-filters";
// Place it anywhere inside your <DolfinProvider>.
<ExpensesFilters filters={filters} />Renders inside DolfinProvider (set it up once). By default it loads its own data through the SDK. Supplied-data examples show how to override that behavior.
API reference
| Prop | Type | Description |
|---|---|---|
filters required | ExpenseFiltersSnapshot | The filter values: the view, whose spend, card, dates, merchant and search (`useExpenseFilters().snapshot`, or your own state). Pass `useExpenseFilters().filters` to `useExpenses` or the table. |
onFiltersChange | (filters: ExpenseFiltersSnapshot) => void | Called with the whole new set on every change (`useExpenseFilters().replace`). |
hide | readonly ExpensesFilterControl[] | Controls to leave out, e.g. `["card"]` on a card's own page. |
children | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Extra controls at the end of the filter row. |
cards | readonly ExpenseCardConnection[] | Cards you already hold, for the card picker; with `merchantName`, nothing is fetched. |
merchantName | string | The narrowed-to merchant's name, for its chip. |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
expenses.expenses
Or edit the installed file directly: it is your code. See theming for colours and fonts.
Hooks
The SDK hooks this component uses. Use them directly from @dolfinai/react to build your own version.
useExpenseCardsuseExpenseMerchantuseMessagesFiles
Written to your app by the install command:
components/dolfin/expenses/expenses-filters.tsx142 lines