Skip to content
GitHub
Browse the docs

Building blocks

Agent proposal

AgentProposal

The agent's suggestion shown on the real controls, with Keep and Revert for the person.

The person sees

Loading preview…

Install
booki_version=$(npm view @booki-aui/react@latest version) &&
ui_sdk_version=$(npm view "@booki-aui/react@$booki_version" peerDependencies.@ui-sdk/core) &&
pnpm add --save-exact "@booki-aui/core@$booki_version" "@booki-aui/react@$booki_version" "@booki-aui/styles@$booki_version" \
  "@ui-sdk/core@$ui_sdk_version" "@ui-sdk/react@$ui_sdk_version"

Usage example

JSX
import { AgentProposal, useAgentProposal } from "@booki-aui/react"
import { agent } from "./agent"

const proposal = useAgentProposal(agent)
await proposal.propose([{ ref: "Invoice amount", key: "minor", value: 985000 }])

<AgentProposal applied={proposal.applied} onKeep={proposal.keep} onRevert={proposal.revert} />

The new amount shows on the field as a proposal. Keep and Revert are marked for a person, so the agent cannot accept its own suggestion.

Import from @booki-aui/react. For Booki's default styling, add import "@booki-aui/styles".