A2uiSurfaceProps
Supplies one published surface snapshot and, optionally, the components that render it.
import type { A2uiSurfaceProps } from '@threadplane/react/a2ui';Declaration
export interface A2uiSurfaceProps {
readonly catalog?: ReactRenderRegistry;
readonly className?: string;
readonly functions?: {
readonly [name: string]: (args: {
readonly [name: string]: A2uiValue;
}) => void;
};
readonly onAction?: (message: A2uiActionMessage) => void;
readonly onValidationError?: (error: A2uiValidationErrorMessage) => void;
readonly surface: A2uiSurfaceSnapshot;
readonly surfaces?: A2uiSurfaces;
}Members
catalog
Components by A2UI name. Defaults to a2uiBasicCatalog(); keep it stable.
readonly catalog?: ReactRenderRegistry;className
readonly className?: string;functions
Runs a Button's function-call action, by function name, with its
arguments resolved from this surface's current data model. Nothing is
sent to the agent. A function named here replaces the built-in one.
openUrl is built in: it opens an http, https, mailto or tel url in a
new tab. A Button whose function nothing can run is disabled.
readonly functions?: {
readonly [name: string]: (args: {
readonly [name: string]: A2uiValue;
}) => void;
};onAction
Receives the action message when a Button with an event action is pressed. Its context is resolved from this surface's current data model. Sending it to the agent is the application's job. Without it, Buttons are disabled.
readonly onAction?: (message: A2uiActionMessage) => void;onValidationError
Called when a press was blocked because an input's validation checks do
not pass, with the first failure as a v0.9 VALIDATION_FAILED error.
onAction is not called for that press.
readonly onValidationError?: (error: A2uiValidationErrorMessage) => void;surface
A surface from createA2uiSurfaces().getSnapshot().surfaces. Snapshots are immutable; pass the current one.
readonly surface: A2uiSurfaceSnapshot;surfaces
The store this snapshot came from. With it, input components write each edit into that surface's data model, and the store publishes a new snapshot for you to pass back. Without it the surface is read-only.
readonly surfaces?: A2uiSurfaces;