dolfindevelopers

Expense search

ComponentExpensesSDK + UI

Natural-language search over card spend ("taxis over £50 last month"): a search box that runs on Enter, and results that show how the search was read (words matched by meaning, exact date, amount, currency and receipt filters), the match count and the matching expenses best first, with loading, empty and error states. Pass result (with loading and error) to render your own results without a request.

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-search

Also installs: badge, button, input, base-theme, base-info-hint, base-states, expenses-table, ui-expenses-search.

Usage

screen.tsx
import { ExpenseSearchResults } from "@/components/dolfin/expenses/expense-search";

// Place it anywhere inside your <DolfinProvider>.
<ExpenseSearchResults />

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
querystringThe search to run.
resultExpenseSearchResultA result you already hold: shown as given, nothing is fetched.
loadingboolean
errorError
onRetry() => void
onClear() => voidShows "Clear results".
emptyStatestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Replaces the "Nothing matches" state.
classNamestring
columnsColumnsReplace or extend the default columns (merchant, spent by, card, date, status, receipt, amount).
columnOrderreadonly string[]
columnVisibilityReadonly<Partial<Record<string, boolean>>>
rowActionsRowActionsMenu entries per row. None by default: the row itself opens the expense.

Customisation

Without editing the source, you can change:

Class names
className
Messages
base.infoHint.moreAboutbase.states.retrybase.states.staleErrorcore.errorsexpenses.expenses.search

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.

useDolfinLocaleuseExpenseSearchuseMessages

Files

Written to your app by the install command:

  • components/dolfin/expenses/expense-search.tsx 168 lines