@get-asset/reactComponents
Receipt Rule Editor
Styled drop-in form to make or change one of a business's receipt rules — never ask, ask every time, or ask over an amount.
Make or change one of a business's receipt rules: the ledger it names, whether to never ask, ask every time or ask over an amount, and the reason shown on the request.
Built on the headless ReceiptRuleEditor compound from @get-asset/sdk.
Preview
Loading preview…
Usage
import { AssetReceiptRuleEditor } from "@get-asset/react";
import "@get-asset/react/styles.css";
<AssetReceiptRuleEditor ruleId={ruleId}
onSaved={() => backToList()}
onCancel={() => backToList()}
/>Required scopes
The access token used by AssetProvider must include these scopes for this component to fetch data successfully:
business:readbusiness:updateledger:read
API reference
Root props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
className | string | No | ||
ruleId | string | No | The rule to edit. Omit to make a new one. "default" is the business's default rule, made on save if the business has none yet. | |
rule | BusinessReceiptRulePublic | No | Override the fetched rule for testing/storybook. Skips the API call. | |
ledgers | LedgerPublic[] | No | Override the ledgers to choose from for testing/storybook. Skips the API call. | |
preview | ReceiptRuleEditorPreview | No | Override the preview and disable its request for testing/storybook. | |
currency | string | No | ISO-4217 code amounts are in. Resolved from the business's country when omitted. | |
formatAmount | (value: number) => string | No | Amount formatting in preview rows. Defaults to currency, in US English. | |
formatDate | (value: string) => string | No | Date formatting in preview rows. Defaults to "Jan 31, 2026". | |
state | "loading" | "error" | No | Force a specific state for testing/storybook. | |
saveError | Error | No | Force the save-error state for testing/storybook. | |
onSaved | (rule: BusinessReceiptRulePublic | null) => void | No | Called with the saved rule once the write goes through; with null when the default rule was set back to the system's defaults. | |
onCancel | () => void | No | The host closes the form without saving. |