Spender picker
Pick the organisation member an expense is attributed to, showing the current spender even before the member list arrives.
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-selectAlso installs: select, base-theme, ui-expenses-spender-select.
Usage
import { SpenderSelect } from "@/components/dolfin/expenses/spender-select";
// Place it anywhere inside your <DolfinProvider>.
<SpenderSelect spender={spender} 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 |
|---|---|---|
spender required | { userId?: string; name?: null | string; email?: null | string; } | The current spender, shown even before (or without) the member list. |
onChange required | (userId: string) => void | Called with the picked member's user id; picking the current one does nothing. |
disabled | boolean | |
members | readonly ExpenseMember[] | People to pick from: listed as given, nothing is fetched. The organisation's members when omitted. |
loading | boolean | |
className | string | |
aria-label | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
expenses.expense.transactionexpenses.expenses.spenderexpenses.expenses.unknownMember
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-select.tsx46 lines