Tax rates table
The organisation's tax rates with name, code, rate and source; platform defaults for its country are locked and explained on hover. Source tabs with counts and a search over name, code and rate, configurable columns and row actions (Edit, Delete on custom rates), and loading, empty and error states.
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/ar-tax-rates-tableAlso installs: input, tabs, base-theme, base-data-table, base-info-hint, base-states, ui-ar-tax-rates-table.
Usage
import { ArTaxRatesTable } from "@/components/dolfin/ar/tax-rates-table";
// Place it anywhere inside your <DolfinProvider>.
<ArTaxRatesTable />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 |
|---|---|---|
filters | TaxRateFilters | The source tab and search; applied in memory to the loaded rates or to your own `taxRates`. |
taxRates | readonly { id?: string; organisationId?: null | string; code: string; name: string; rate?: number | string; source: string; isReadOnly?: boo… | Your own rates (all of them; `filters` narrows them): the table then makes no request. |
loading | boolean | |
error | Error | |
onRetry | () => void | |
columns | TaxRateColumn[] | ((defaults: TaxRateColumn[]) => TaxRateColumn[]) | |
columnOrder | readonly string[] | |
columnVisibility | Readonly<Partial<Record<string, boolean>>> | |
rowActions | TaxRateRowAction[] | ((defaults: TaxRateRowAction[]) => TaxRateRowAction[]) | Replace or extend the row menu (defaults: Edit and Delete on custom rates, when their handlers are given). |
onEdit | (taxRate: TaxRate) => void | |
onDelete | (taxRate: TaxRate) => void | |
editDisabledReason | string | Edit and Delete stay visible and is disabled with this reason in an InfoHint when non-empty (`""` = enabled). By id, `undefined` means the SDK's reason for a role that can't manage them. |
deleteDisabledReason | string | The same for Delete. |
isRowBusy | (taxRate: TaxRate) => boolean | |
sort | DataTableSort | |
onSortChange | (sort: DataTableSort | null) => void | |
emptyState | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Replaces the empty state shown when the organisation has no rates at all. |
emptyAction | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | An action inside the default empty state (e.g. a New rate button). |
className | string | |
variant | DataTableVariant | |
classNames | DataTableClassNames | |
pager | boolean | Show the built-in previous / next pager when there is more than one page. Default true; pass false when you draw your own pager from the list's pagination (the table still dims while a page loads). |
onRowHover | (row: { id?: string; organisationId?: null | string; code: string; name: string; rate?: number | string; source: string; isReadOnly?: boolea… | Called with the row the pointer moves onto, and with `null` when the pointer leaves the rows (e.g. to highlight the row's point in a chart next to the table). Moving between rows reports the new row without a `null` first. |
Customisation
Without editing the source, you can change:
- Class names
classNameclassNames.frameclassNames.headerclassNames.headerCellclassNames.rowclassNames.cellclassNames.pager- Messages
ar.taxRatesbase.infoHint.moreAbout
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.
useCanManageTaxRatesuseDolfinLocaleuseMessagesuseTaxRatesFiles
Written to your app by the install command:
components/dolfin/ar/tax-rates-table.tsx218 linescomponents/dolfin/ar/tax-rates-filters.tsx22 lines