Whose spend filter
Pick whose spend a view shows: Everyone, My spend, or one organisation member searched by name on the server, with loading, empty and error states in the list.
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-spender-filterAlso installs: button, command, popover, base-theme, base-states, ui-expenses-spender-filter.
Usage
import { SpenderFilter } from "@/components/dolfin/expenses/spender-filter";
// Place it anywhere inside your <DolfinProvider>.
<SpenderFilter value={value} onChange={handleChange} />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 |
|---|---|---|
value required | SpenderScope | |
onChange required | (scope: SpenderScope) => void | |
hideMine | boolean | Hides "My spend" (an API key has no "me"). |
members | readonly ExpenseMember[] | People you already hold: listed as given and matched by name or email here; nothing is fetched. |
loading | boolean | |
error | Error | |
onRetry | () => void | |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
base.statescore.errorsexpenses.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.
useExpenseMemberOptionsuseMessagesFiles
Written to your app by the install command:
components/dolfin/expenses/spender-filter.tsx108 lines