Approval and Question Cards, Config Shell
Part of the drop-in UI blocks: headless rules in @reactive-agents/ui-core, thin Svelte 5 components in @reactive-agents/svelte/components, sharing @reactive-agents/svelte/styles.css, the --ra-* variables and the icons registry. The same blocks ship for React and Vue.
Cards and config shell
Section titled “Cards and config shell”ApprovalCard (an approval gate on a tool call) and QuestionCard (a request_user_input question) cover a run paused on a person. ConfigSection, FieldRow and ListField build a settings form. None owns a store or makes a request: you pass busy and error in and perform the decision in a callback.
Headless rules (ui-core)
Section titled “Headless rules (ui-core)”Approval rules (cards/approval-card):
| Rule | What it gives you |
|---|---|
approvalArgRows(args, mask?) |
One { key, value } row per top-level argument, values clipped to 160 characters (MAX_ARG_CHARS) on one line |
approvalFullArgs(args, mask?) |
The full parameters as readable text (pretty JSON; a string stays as is), capped at 20,000 characters (MAX_FULL_ARG_CHARS); "" when there are none |
approvalArgsNeedDetail(args) |
True when the rows lose something the full text shows (a clipped, multi-line or nested value) |
approvalCardKey({ runId, gateId }) |
"runId|gateId", the key one card is tracked under |
hideCardKey(hidden, key) |
The set with key added, for hosts that keep hidden cards in their own store |
approvalCardMode({ busy?, denying? }) |
"busy" (wins), "deny-reason" or "decide" |
denyReasonOf(text) |
The trimmed reason, or undefined when blank |
cardDismissKind({ onHide?, onDismiss? }) |
"dismiss", "hide" or undefined; see below |
Question rules (cards/question-card and cards/structured-questions):
| Rule | What it gives you |
|---|---|
replyControl({ kind, schema }) |
"confirmation", "choice", "form" or "text". A choice with no usable options, or a form with no fields, falls back to "text" |
choiceOptions(schema) |
The non-blank string schema.options of a choice question |
formFields(schema) |
The schema.fields of a form question as { name, label, type, required } (type is text, number or boolean); unnamed fields are skipped |
formValue(fields, draft) |
{ value, missing }: numbers as numbers, booleans as booleans, blank optional fields left out, missing lists blank required fields by label |
questionCardMode(busy) |
"busy" when a reply or a Dismiss is in flight, else "reply" |
questionsOf({ questions?, schema? }) |
The typed questions of a structured ask, from questions or schema.questions (a durable pause stores them there). Malformed entries are dropped |
buildAnswers(questions, draft) |
{ ok: true, answers } (an id-keyed map) or { ok: false, errors } (one message per question id). Checks required, number range, maxLength, pick counts and options unless allowOther |
List rules (cards/list-edit), all pure and returning a new array: splitEntries(text) (split on commas and new lines, trimmed), addUnique(list, entries, keyOf?) (first wins), isListed(list, key, keyOf?), removeAt(list, index), replaceAt(list, index, item), duplicateIssues(list, message, keyOf?) and issuesAt(issues, index). A ListIssue is { index, message }.
Two kinds of Dismiss
Section titled “Two kinds of Dismiss”A card’s Dismiss button does one of two different things, and you choose by the callback you pass:
onHideonly takes the card off the screen. The approval or question stays pending, reachable elsewhere (a run header, a “waiting on you” list). Nothing is sent.onDismissis a decision your app sends, for example a request to the server that dismisses the gate. The card showsbusy="dismiss"while you wait.
cardDismissKind reads which you wired. If you pass both, onDismiss wins. With neither there is no Dismiss button. The button carries data-action="hide" or data-action="dismiss" to match.
ApprovalCard
Section titled “ApprovalCard”<script lang="ts"> import "@reactive-agents/svelte/styles.css"; import { ApprovalCard } from "@reactive-agents/svelte/components"; import type { ApprovalDecision, ApprovalRequest } from "@reactive-agents/ui-core";
let { approval }: { approval: ApprovalRequest } = $props(); let busy = $state<ApprovalDecision | "dismiss" | undefined>(); let error = $state<string | undefined>(); let hidden = $state(false);
// Your app performs the decision; the card only shows its state. async function decide(verdict: ApprovalDecision, reason?: string) { busy = verdict; error = undefined; try { await sendDecision(approval, verdict, reason); // your own request } catch (e) { error = e instanceof Error ? e.message : String(e); busy = undefined; } } const redact = (text: string) => text.replace(/sk-[A-Za-z0-9]+/g, "sk-…");</script>
{#if !hidden} <ApprovalCard {approval} {busy} {error} mask={redact} onApprove={() => decide("approve")} onDeny={(reason) => decide("deny", reason)} onHide={() => (hidden = true)} />{/if}sendDecision is your own request. The docs build does not type-check this example.
- Props:
approval(ApprovalRequest:runId,gateId,toolName,args, optionalsubAgent),onApprove,onDeny(reason)(reasonisundefinedwhen left blank),onHide,onDismiss,busy("approve" | "deny" | "dismiss": the buttons are replaced by a status line),busyText(that line in your wording),error(why the last decision was refused),mask,expanded(start with the full parameters),labels,icons,class. - Deny opens a reason row first; a refused denial keeps the typed reason.
- Snippets:
header({ approval, heading })replaces the status line,parameters({ approval })the parameter block,actions({ mode, approve, deny, dismiss, busy })the whole button row,icon(id)the icon of a button. - Hooks:
data-ra-approval,data-ra-tool(the tool name),data-mode(busy,deny-reasonordecide),data-actionon each button (approve,deny,deny-confirm,back,hideordismiss), plusdata-run-idanddata-gate-id. ApprovalParamsis the parameter block on its own: one row per argument and, when a row loses detail, a toggle that swaps the rows for the full text. Propsargs,open,mask,labels.
The ui-core default shows parameter values as they are. It does not mask anything, so a gated call that carries a token or key shows it. Pass mask to hide secrets; it applies to both the rows and the full text.
QuestionCard
Section titled “QuestionCard”<script lang="ts"> import { QuestionCard } from "@reactive-agents/svelte/components"; import type { QuestionBusy, QuestionRequest } from "@reactive-agents/ui-core";
let { question }: { question: QuestionRequest & { questions?: unknown } } = $props(); let busy = $state<QuestionBusy | undefined>(); let error = $state<string | undefined>();
async function reply(value: unknown) { busy = "reply"; try { await sendAnswer(question, value); // your own request } catch (e) { error = e instanceof Error ? e.message : String(e); busy = undefined; } }</script>
<QuestionCard {question} {busy} {error} onReply={reply} onInvalid={(message) => (error = message)} onDismiss={() => { busy = "dismiss"; void sendDismiss(question); }}/>sendAnswer and sendDismiss are your own requests.
- Props:
question(QuestionRequest:runId,interactionId,kind,prompt,schema, plusquestionsfor a structured ask),onReply(value),onInvalid(message)(a required form field left blank),onHide,onDismiss,busy("reply" | "dismiss"),error,labels,class. - The reply control follows
replyControl: yes/no forconfirmation, buttons forchoice, fields forform, otherwise a free-text box. A structured ask replaces the kind’s control withQuestionForm, andonReplythen receives the id-keyed answer map. The card is keyed oninteractionId, so a follow-up question starts with a clean box. - Snippets:
header({ question, heading }),prompt({ question }),reply({ question, send })(the whole reply control),structured({ questions, send })(only the structured form),actions({ dismiss })(the Dismiss row). - Hooks:
data-ra-question,data-mode(busyorreply),data-actionon Dismiss,data-run-id,data-interaction-id. QuestionReply(propskind,schema,questions,onSend,onInvalid,labels,structured; hooksdata-ra-question-reply,data-control) andQuestionForm(propsquestions,onSend,disabled,labels) work alone in a different frame.
ConfigSection, FieldRow and ListField
Section titled “ConfigSection, FieldRow and ListField”<script lang="ts"> import { ConfigSection, FieldRow, ListField } from "@reactive-agents/svelte/components"; import { addUnique, removeAt, splitEntries, duplicateIssues } from "@reactive-agents/ui-core";
let open = $state(true); let blocked = $state<string[]>([]); const issues = $derived(duplicateIssues(blocked, (k) => `${k} is listed twice.`));</script>
<ConfigSection id="guardrails" title="Guardrails" open={open} onToggle={() => (open = !open)}> {#snippet head()}{blocked.length} blocked{/snippet} <FieldRow label="Blocked phrases" for="blocked" description="Runs that match are stopped."> {#snippet control()} <ListField id="blocked" items={blocked} {issues} onAdd={(text) => { const entries = splitEntries(text); if (entries.length === 0) return false; blocked = addUnique(blocked, entries); }} onRemove={(i) => (blocked = removeAt(blocked, i))} /> {/snippet} </FieldRow></ConfigSection>ConfigSection: propsid,open,onToggle,title,icon(an icon id),flat,hideTitle,idPrefix(defaultra-config),icons,class; snippetshead(a short summary beside the title) and the body. It is collapsible by default.flatmakes a plain, always-open panel for layouts where a nav picks what shows;hideTitlekeeps that heading for screen readers only. Your app owns the open state. Element ids are{idPrefix}-section-{id},{idPrefix}-head-{id}and{idPrefix}-panel-{id}, for deep links. Hooks:data-ra-config-section,data-open,data-flat.FieldRow: label and help on the left, the control on the right (stacked under 720px). Propslabel,for(the control’s id; the help text gets the id${for}-hintforaria-describedby),description,wide,class; snippetshelp(rich help text in place ofdescription) andcontrol. Hook:data-ra-field-row.ListField: propsid,items,text(an entry’s label; defaultString),onAdd(text)(returnfalseto reject the entry and keep the text in the box),onRemove(index),issues,draft(bindable),variant("chips"default, or"rows"),suggestions,labels,icons,class. Snippets:item({ item, index, text, remove, issues })replaces an entry (it then draws its own remove button),draftExtrasadds controls between the box and Add,belowgoes under the add row,emptyshows when there are no entries. Hooks:data-ra-list-field,data-variant,data-ra-list-item.
ReceiptCard
Section titled “ReceiptCard”ReceiptCard draws the trust receipt of a finished run: the verdict, the verifier’s verdict or that it did not run, how the run ended, the tools used, declared deliverables, each harness intervention, recovered tool effects, provenance, the signature state, and a copy action for the raw JSON. The verdict grades the run’s evidence trail, never whether the answer is true. The same card ships for Svelte, React and Vue, over one ui-core view model (receiptViewOf), so the three show the same lines and labels.
<script lang="ts"> import { ReceiptCard } from "@reactive-agents/svelte/components"; import "@reactive-agents/svelte/styles.css";
let { receipt, verified }: { receipt: unknown; verified?: boolean } = $props();</script>
<ReceiptCard {receipt} signature={verified === undefined ? undefined : verified ? "valid" : "invalid"} />The card makes no request and checks no signature. Pass the receipt you have (AgentResult.receipt, the StreamCompleted event’s receipt, or a stored copy) and, when you checked it with verifyReceipt, the result as signature. A signed receipt with no signature prop is shown as signed but not checked.
| Prop | Type | What it does |
|---|---|---|
receipt |
unknown |
The receipt. null or undefined shows the empty state |
signature |
"valid" | "invalid" | "unsigned" | "unchecked" |
The result of your signature check |
redacted |
boolean (default false) |
Says the copy at hand had a secret value removed by its keeper. A signed copy then cannot match its signature, and the card says so instead of calling it invalid |
noneReason |
string |
Why there is no receipt, in your words, shown in the empty state |
labels |
Partial<ReceiptCardLabels> |
Reword or translate headings and button text. Defaults: DEFAULT_RECEIPT_LABELS |
onCopy |
(json: string) => void |
Replaces the clipboard write of the copy action. In Vue this is the copy event |
class |
string |
Extra class on the card (className in React) |
Styling and test hooks: data-ra-receipt, data-state, data-verdict, data-signature, data-tone on graded lines, data-action="copy" and data-testid="receipt-card".
Labels and tokens
Section titled “Labels and tokens”Pass any subset of ApprovalCardLabels, QuestionCardLabels, ReceiptCardLabels or ListFieldLabels as labels to reword or translate. Defaults: DEFAULT_APPROVAL_LABELS, DEFAULT_QUESTION_LABELS, DEFAULT_RECEIPT_LABELS, DEFAULT_LIST_FIELD_LABELS.
New tokens: --ra-card-rail (the 2px rail down the left of a card; default --ra-warn), --ra-card-tool (the tool name in an approval card; default --ra-fg-muted), --ra-field-control-width (default 280px) and --ra-field-control-width-wide (default 340px), the control column of a FieldRow. They carry var() fallbacks and take their colours from tokens that already have light and dark values, so they have no dark set of their own.
What’s Next
Section titled “What’s Next”- Drop-in UI blocks overview: the other block pages
- Agentic UI Core: the protocol, run state and the other Svelte blocks
- Web Integration: React, Vue and Svelte bindings
Install
Bun (recommended)bun add reactive-agentsNode 22.5+npm install reactive-agentsGet notified on new releases
Release notes, about once a month.