Approval Card
ProNewThe question an agent asks before it acts: options, a custom answer, and a folded record of the decision.
Installation
pnpm dlx shadcn@latest add @viewport/approval-card
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| question* | stringWhat the agent is asking. | — |
| description | stringContext under the question. | — |
| options* | ApprovalOption[] | — |
| allowCustom | booleanAdds a free-text answer as the last choice. | false |
| confirmLabel | stringLabel for the confirm button. | "Continue" |
| onSubmit | (answer: string) => voidCalled with the chosen option's value, or the typed text for a custom answer. | — |
| onSkip | () => voidCalled when the question is skipped. Omit to hide the skip button. | — |
| className | string | — |
Accessibility
- Options are a Radix radio group: arrow keys and number keys both select.
- The question labels the group; the result is announced as a status.
- Enter submits from anywhere in the card.