For development, import
GuidanceCard from @servicetitan/anvil2-ai-kit. For design, find it in the AI Kit Web Component Library file.Options
The Guidance Card supports four lifecycle states, single and table change sections, and an optional linked reference.States
default shows selectable diffs with Accept, Edit, and Reject actions. accepted, rejected, and skipped collapse the same content into a read-only disclosure that starts closed — expand it to review what was suggested.
Change Sections
A change section is eithersingle — one or more scalar diff rows — or table — one or more labeled line-item tables. Combine both types, in any order, within changeSections to build a mixed review.
Reference Link
referenceHref turns the reference label into a link that opens the related estimate or invoice in a new tab. Omit it to render the label as plain text.
Behavior
In the default state, every change starts selected; the card tracks its own selection from there and disables its footer actions once everything is deselected.Selection
When a section has more than one selectable change, each row starts checked and gets its own checkbox — uncheck a row to exclude it before accepting. A lone change omits the checkbox entirely; Accept always applies to it.Actions
Accept and Edit are enabled by default — every change starts selected — and disable only once every change is deselected. Reject is always available and needs no selection. Accept and Edit each receive the ids of the currently selected changes and table rows.Usage Guidelines
When to Use
Use the Guidance Card when:- Reviewing changes the agent proposes – The agent suggests changes to a record, such as an estimate or invoice, and the user accepts, edits, or rejects them.
- Accepting only some changes – A section holds several changes. Each row gets a checkbox so the user can exclude a change before accepting.
- Reviewing line-item changes – Proposed changes affect rows in a list of items. Use a table change section, alone or combined with single change sections.
- Recording the outcome of a review – After the user acts, show the accepted, rejected, or skipped state as a read-only summary the user can expand.
When not to use
Avoid using the Guidance Card for:- Showing a change without review actions – Use the Diff Value instead.
- Offering follow-up prompts after an agent response – Use the Suggestion instead.
Keyboard Interaction
Users can navigate, select, and act on the Guidance Card using standard keyboard controls.Code
- Implementation
- GuidanceCard Props
- GuidanceChange
Common Examples
To use theGuidanceCard, pass a referenceLabel and ordered changeSections. Wire onApply, onEdit, and onDismiss to handle Accept, Edit, and Reject.States
state is "default", "accepted", "rejected", or "skipped". Non-default states collapse the body unless you set defaultExpanded. Accepted state can filter visible rows through appliedChangeIds.Selection
Multiple single changes each get a checkbox. A single change has no checkbox; Accept applies to that item.Change sections
Usetype: "single" for scalar diffs and type: "table" for labeled line-item tables. Table cells may be a string, { type: "text", value }, { type: "diff", from, to }, or { type: "addition", value }.Reference link
PassreferenceHref to make the reference label a link.Actions
Accept and Edit receive the currently selected single-change and table-row ids. Reject callsonDismiss with no selection.Internationalization
GuidanceCard owns these localized strings:ai-kit.guidanceCard.suggestedChangesai-kit.guidanceCard.suggestionsAcceptedai-kit.guidanceCard.suggestionsRejectedai-kit.guidanceCard.suggestionsSkippedai-kit.guidanceCard.acceptai-kit.guidanceCard.editai-kit.guidanceCard.rejectai-kit.guidanceCard.reasonPrefix
referenceLabel, change labels, reasons, and table headers before passing them. Mount AiKitIntlProvider inside CartoTheme to switch the built-in strings.React Accessibility
- Title text reflects the current
state. - Multiple changes expose selectable rows. A single change applies without a checkbox.
- Table groups use the kit table selection semantics, including localized select-all and select-row labels.