dolfindevelopers

Expenses filters

ComponentExpensesSDK + UI

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

Choose your integration

Ready to connect to Dolfin. Loads data through SDK hooks, with appearance and behaviour you can customise. Requires DolfinProvider.

Loading preview…

Installation

Needs the Dolfin registry token. The CLI copies the source into your app.

Terminal
bunx --bun shadcn@4.23.0 add @dolfin/expenses-filters

Also installs: button, input, select, tabs, base-theme, expenses-spender-filter, ui-expenses-filters.

Usage

screen.tsx
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

PropTypeDescription
filters requiredExpenseFiltersSnapshotThe 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) => voidCalled with the whole new set on every change (`useExpenseFilters().replace`).
hidereadonly ExpensesFilterControl[]Controls to leave out, e.g. `["card"]` on a card's own page.
childrenstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Extra controls at the end of the filter row.
cardsreadonly ExpenseCardConnection[]Cards you already hold, for the card picker; with `merchantName`, nothing is fetched.
merchantNamestringThe narrowed-to merchant's name, for its chip.
classNamestring

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.

useExpenseCardsuseExpenseMerchantuseMessages

Files

Written to your app by the install command:

  • components/dolfin/expenses/expenses-filters.tsx 142 lines