Merchant detail
One merchant: name, spend per currency, expense count, category and first seen; how the card networks spell it (as printed, cleaned, recognised automatically or first spelling, first seen); and a Spend here section with the expenses made there (and a link to the filtered expenses list). Loading, not found and error states. Fetches by merchant id (the merchant and its spend in parallel), or shows the merchant you pass and fetches nothing. Header actions, the Spend here body and extra sections are plain props; takes the spelling columns.
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-merchant-detailAlso installs: badge, expenses-merchants-table, expenses-table, base-data-table, base-info-hint, base-page, base-states, base-theme, ui-expenses-merchant-detail, ui-base-data-table.
Usage
import { MerchantDetail } from "@/components/dolfin/expenses/merchant-detail";
// Place it anywhere inside your <DolfinProvider>.
<MerchantDetail />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 |
|---|---|---|
merchantId | string | Fetches the merchant, and the spend made there for the "Spend here" section. |
merchant | { aliases?: components["schemas"]["MerchantAliasResponse"][]; id?: string; displayName?: null | string; logoUrl?: null | string; mcc?: null … | Your merchant. Passing `merchant`, `loading` or `error` means nothing is fetched; `null` reads as not found. |
loading | boolean | |
error | Error | |
onRetry | () => void | Shows "Try again" in the error state. |
expenses | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | The "Spend here" section body. By id it defaults to the expenses made there; with your own merchant there is no default. `null` drops the section. |
headerActions | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Buttons in the header. |
sections | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Extra sections after the spellings. |
aliasColumns | MerchantAliasColumnsProp | |
before | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Rendered above the header in every state (e.g. a back link). |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
base.infoHint.moreAboutexpenses.merchants
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.
useDolfinLocaleuseExpensesuseMerchantuseMessagesFiles
Written to your app by the install command:
components/dolfin/expenses/merchant-detail.tsx284 lines