ComponentsAI & chat

Chat Confirmation

Asks someone in chat to approve or decline an action an agent proposed. It is a Review Card with a shield icon, a status badge, the facts as rows, and two buttons. Once decided it folds and shows the outcome.

ChangeStateLocked

Approval required

Review these changes before approving.

Action
Change table schema
Table
tbl_7d1c4e2a9b
Proposal
mig_3f8a21c6d0
Plan digest
sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
Applied revision
42
Effect
Remove field values
Affected rows
128
Field
fld_notes_91ce

Usage

A table change waiting for approvalTSX
import {
  ChatConfirmation,
  type ConfirmationState,
} from "@tulipfarm/sprout/chat-confirmation";

const [state, setState] = useState<ConfirmationState>({ kind: "pending" });

<ChatConfirmation
  title="Remove the Notes field from Supplier deliveries"
  description="Review these changes before approving."
  details={[
    { label: "Action", value: "Change table schema" },
    { label: "Effect", value: "Remove field values" },
    { label: "Affected rows", value: "128" },
  ]}
  state={state}
  disabled={!canVerifyEffect}
  onDecision={async (decision) => {
    setState({ kind: "submitting", decision });
    setState(await save(decision));
  }}
/>

  • title: what the agent wants to do. Long titles end with an ellipsis.
  • description: one line above the facts.
  • details: { label, value }[], shown in order. Long values wrap.
  • state: pending,{ kind: "submitting", decision },approved, rejected, expired,cancelled, or{ kind: "error", message }.
  • onDecision: called with "approve" or"reject".
  • disabled: locks both buttons, such as while the request is refreshing or its effect cannot be verified.

States

Pending, submitting, and error show Approval requiredwith both buttons. While submitting, both are disabled and the chosen one shows a spinner. An error shows above the buttons so people can try again. Approved, declined, expired, and cancelled fold the card and show the outcome.

Every statePending, submitting, error, and the four settled outcomes

Approval required

Review these changes before approving.

Action
Change table schema
Table
tbl_7d1c4e2a9b
Effect
Remove field values
Affected rows
128
Field
fld_notes_91ce

Approval required

Review these changes before approving.

Action
Change table schema
Effect
Convert field values
Affected rows
1204
Field
fld_delivery_date_4a

Approval required

Review these changes before approving.

Action
Change table schema
Effect
Remove table rows
Affected rows
37

Approval required

Ask for permission before the sample action.

Message
Please water the garden.

Approved

Declined

Expired

Cancelled

Table approval in chat

A schema change with its request status below: details, a status check, and an alert when the refresh failed. The buttons lock while the request needs a check and when the effect cannot be verified.

Table approval in chatApprove and decline change local state only
EffectRequest

Approval required

Review these changes before approving.

Action
Change table schema
Table
tbl_7d1c4e2a9b
Proposal
mig_3f8a21c6d0
Plan digest
sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
Applied revision
42
Effect
Remove field values
Affected rows
128
Field
fld_notes_91ce

Settle without submitting

A decision can settle at once. Pick any state from the menu.

Approval statesDecisions settle at once, with no submitting step
Reminder state

Approval required

Ask for permission before the sample action.

Message
Please water the garden.

Accessibility

The card is a section named by the title, which is anh4 button that opens and closes the details. A busy button hasaria-busy and its spinner is hidden. Errors userole="alert"; the outcome uses role="status". If the decision was made from inside the card, focus moves to the outcome when it settles, so keyboard users keep their place.

The details grow and shrink in 180ms; with reduced motion they change at once.

Theme tokens

Text uses --sprout-muted, errors--sprout-danger, and the outcome focus ring--sprout-focus. The card, badge, and buttons use their own tokens.