dolfindevelopers

Create tax rate dialog

DialogReceivablesSDK + UI

Add a custom tax rate (code, name, 0 to 100%) in a dialog. Checks the fields before saving, shows the API's errors (such as a code already in use), and refreshes the tax rates list and every tax rate picker.

Dialog: a modal you open from your own screen. You control when it opens with its props. 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/ar-create-tax-rate-dialog

Also installs: button, dialog, base-theme, ar-tax-rate-form, ui-ar-create-tax-rate-dialog.

Usage

screen.tsx
import { ArCreateTaxRateDialog } from "@/components/dolfin/ar/create-tax-rate-dialog";

// Place it anywhere inside your <DolfinProvider>.
<ArCreateTaxRateDialog open={open} onOpenChange={handleOpenChange} />

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
open requiredboolean
onOpenChange required(open: boolean) => void
onCreated(taxRate: TaxRate) => voidAfter the rate was created; the dialog has closed.
initialValuesPartial<TaxRateFormValue>Prefill. Applied each time the dialog opens.
onSubmit(body: CreateTaxRateRequest) => Promise<TaxRate | void> | voidSaves it yourself instead of the SDK. The dialog closes once it resolves and shows the error in place if it rejects.
submittingbooleanYour own save is running.
childrenstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Extra fields after the rate.
titlestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…
descriptionstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…
classNamestring

Customisation

Without editing the source, you can change:

Class names
className
Messages
ar.taxRates

Or edit the installed file directly: it is your code. See theming for colours and fonts.

Hooks

The SDK hooks this dialog uses. Use them directly from @dolfinai/react to build your own version.

useMessagesuseTaxRateMutations

Files

Written to your app by the install command:

  • components/dolfin/ar/create-tax-rate-dialog.tsx 122 lines