Skip to Content
@get-asset/sdkComponents

Classification Rules

List active and archived business classification rules, read their conditions and actions, and archive, restore or undo an archive. Add and Edit hand off to your own editor.

Anatomy

Import the primitive and compose the parts you need.

<ClassificationRules.Root onAddRule={openCreate} onEditRule={openEdit}>  <ClassificationRules.HasRules>    <ClassificationRules.ViewTrigger view="active" />    <ClassificationRules.ViewTrigger view="archived" />  </ClassificationRules.HasRules>  <ClassificationRules.AddRuleTrigger />  <ClassificationRules.Loading>Loading rules…</ClassificationRules.Loading>  <ClassificationRules.Error>    <ClassificationRules.ErrorMessage />    <ClassificationRules.Retry>Try again</ClassificationRules.Retry>  </ClassificationRules.Error>  <ClassificationRules.Empty>No rules</ClassificationRules.Empty>  <ClassificationRules.Success>    <ClassificationRules.Rules>      <ClassificationRules.Rule>        <ClassificationRules.Sentence>          <ClassificationRules.Clause>            <ClassificationRules.ClauseConnector />            <ClassificationRules.ClauseValues><ClassificationRules.ClauseValue /></ClassificationRules.ClauseValues>          </ClassificationRules.Clause>        </ClassificationRules.Sentence>        <ClassificationRules.MatchCount />        <ClassificationRules.LastMatched />        <ClassificationRules.CreatedAt />        <ClassificationRules.EditTrigger />        <ClassificationRules.ArchiveTrigger />        <ClassificationRules.RestoreTrigger />      </ClassificationRules.Rule>    </ClassificationRules.Rules>    <ClassificationRules.HasMore><ClassificationRules.LoadMore>Load more</ClassificationRules.LoadMore></ClassificationRules.HasMore>    <ClassificationRules.LoadMoreError />  </ClassificationRules.Success>  <ClassificationRules.UndoToast><ClassificationRules.UndoMessage /><ClassificationRules.UndoTrigger /></ClassificationRules.UndoToast>  <ClassificationRules.WriteErrorToast><ClassificationRules.WriteError /></ClassificationRules.WriteErrorToast></ClassificationRules.Root>

Required scopes

The access token used by AssetProvider must include these scopes for this primitive to fetch data successfully:

  • classification_rule:read
  • classification_rule:update
  • external_account:read
  • ledger:read

API reference

Root props

PropTypeDefaultDescription
childrenReactNode—Compound parts. Required on the SDK Root.
state"loading" | "error" | "empty"—Force a state and skip API reads.
rulesTxnClassificationRulePublic[]—Override rules and skip API reads; archive and restore operate locally.
missingLedgerIdsstring[]—Additional ledger ids treated as missing. Applies to overridden and fetched rules.
view"active" | "archived"—Current view. Pair with onViewChange to control it.
defaultView"active" | "archived"—Initial uncontrolled view; defaults to active.
onViewChange(view: ClassificationRulesView) => void—Called when the selected view changes.
onAddRule() => void—Open the host editor in create mode.
onEditRule(ruleId: string) => void—Open the host editor for the selected rule.
pageSizenumber—Rules per API request; defaults to 25.
hasMoreboolean—Override pagination availability when rules is provided.
hasRulesboolean—Override whether either view has rules when rules is provided; controls view tabs.
formatAmount(value: number) => string—Money formatting in rule sentences. Defaults to US dollars.
formatDate(value: string) => string—ISO date formatting. SDK defaults to Jan 31, 2026; React defaults to Jan 31.

Parts

Compound parts

Value, wrapper and action parts support asChild. Gates and iterators take children. Select bindings clone a child accepting value, onValueChange and disabled. Row parts must be nested inside their iterator.

PartDescription
ClassificationRules.RootOwns business-scoped fetching, view selection, pagination, archive/restore and undo.
ClassificationRules.LoadingRenders during the initial read.
ClassificationRules.ErrorRenders on initial read failure.
ClassificationRules.SuccessRenders when the selected view contains rules.
ClassificationRules.EmptyRenders when the selected view has no rules.
ClassificationRules.ActiveViewRenders while active is selected.
ClassificationRules.ArchivedViewRenders while archived is selected.
ClassificationRules.HasRulesRenders when either view contains a rule.
ClassificationRules.NoRulesRenders when the business has no rules.
ClassificationRules.ErrorMessageFriendly load-error copy; accepts format(error).
ClassificationRules.RetryRetry the failed initial reads.
ClassificationRules.ViewTriggerSelects a view; requires view="active" or view="archived" and exposes data-selected.
ClassificationRules.AddRuleTriggerCalls onAddRule to open the host editor.
ClassificationRules.RulesIterates the current rules, providing row context.
ClassificationRules.RuleRow wrapper with data-rule-id and data-active.
ClassificationRules.SentenceIterates the current rule sentence clauses.
ClassificationRules.ClauseClause wrapper with data-clause.
ClassificationRules.ClauseConnectorRenders the words connecting clause values.
ClassificationRules.ClauseValuesIterates the current clause values.
ClassificationRules.ClauseValueRenders one chip value, with data-kind and data-missing for unavailable categories.
ClassificationRules.MatchCountRenders transaction match count; accepts format(number).
ClassificationRules.LastMatchedLast match date; accepts format(ISO string) and placeholder for never matched.
ClassificationRules.CreatedAtCreation date; accepts format(ISO string).
ClassificationRules.EditTriggerCalls onEditRule with the current rule id.
ClassificationRules.ArchiveTriggerArchives the current active rule; disabled while a write is pending.
ClassificationRules.RestoreTriggerRestores the current archived rule.
ClassificationRules.UndoToastGate for the latest archive undo notification.
ClassificationRules.UndoMessageArchive notification copy; accepts format(sentence: RuleSentenceClause[]).
ClassificationRules.UndoTriggerRestores the most recently archived rule.
ClassificationRules.DismissUndoDismisses the undo notification.
ClassificationRules.WriteErrorToastGate for an archive/restore error.
ClassificationRules.WriteErrorFriendly write-error copy; accepts format(error).
ClassificationRules.DismissWriteErrorDismisses the write error.
ClassificationRules.HasMoreGate while another page exists.
ClassificationRules.LoadMoreRequests the next page, or retries a failed page.
ClassificationRules.AutoLoadMoreIntersectionObserver sentinel; pauses on page failure until manual retry.
ClassificationRules.HasLoadMoreErrorGate for a failed next page while retaining loaded rows.
ClassificationRules.LoadMoreErrorNext-page error copy; accepts format(error).
ClassificationRules.useClassificationRulesRoot context hook for view, loading, errors and actions.
ClassificationRules.useClassificationRuleCurrent rule context hook; use within Rules.
ClassificationRules.useClauseCurrent sentence clause hook; use within Sentence.
ClassificationRules.useClauseValueCurrent chip value hook; use within ClauseValues.
ClassificationRules.scopesRequired OAuth scope array.

On this page