logoAnt Design X

DesignDevelopmentComponentsX MarkdownX SDKX CardX SkillPlayground
  • Introduction
  • A2UI v0.8
  • A2UI v0.9

A2UI v0.8

API

Common props ref: Common Props

BoxProps

Box component serves as a container to manage Card instances and command dispatching.

PropertyDescriptionTypeDefaultVersion
childrenChild elementsReact.ReactNode--
componentsCustom component mapping, component names must start with uppercase lettersRecord<string, React.ComponentType<any>>--
commandsA2UI command objectA2UICommand_v0_9 | XAgentCommand_v0_8--
onActionCallback function when action is triggered inside Card(payload: ActionPayload) => void--

CardProps

Card component is used to render a single Surface.

PropertyDescriptionTypeDefaultVersion
idSurface ID, corresponding to surfaceId in commandsstring--

ActionPayload

Data structure for action events.

PropertyDescriptionTypeDefaultVersion
nameEvent namestring--
surfaceIdThe surfaceId that triggered the actionstring--
contextComplete dataModel snapshot of current surfaceRecord<string, any>--

XAgentCommand_v0_8

Command type for v0.8 version, supporting the following commands:

SurfaceUpdateCommand

Update components on a Surface.

PropertyDescriptionTypeDefaultVersion
surfaceUpdate.surfaceIdSurface IDstring--
surfaceUpdate.componentsComponent listComponentWrapper_v0_8[]--

ComponentWrapper_v0_8

Component wrapper structure for v0.8 version.

typescript
interface ComponentWrapper_v0_8 {
id: string;
component: {
[componentType: string]: {
child?: string;
children?: string[] | ExplicitList;
[key: string]: any | PathValue | LiteralStringValue;
};
};
}

ExplicitList

typescript
interface ExplicitList {
explicitList: string[];
}

DataModelUpdateCommand

Update data model (v0.8 format).

PropertyDescriptionTypeDefaultVersion
dataModelUpdate.surfaceIdSurface IDstring--
dataModelUpdate.contentsData content listArray<{ key: string; valueMap: Array<{ key: string; valueString: string }> }>--

BeginRenderingCommand

Begin rendering.

PropertyDescriptionTypeDefaultVersion
beginRendering.surfaceIdSurface IDstring--
beginRendering.rootRoot component IDstring--

DeleteSurfaceCommand

Delete a Surface.

PropertyDescriptionTypeDefaultVersion
deleteSurface.surfaceIdSurface IDstring--

PathValue

Data binding path object.

typescript
interface PathValue {
path: string;
}

LiteralStringValue

Literal string value object (v0.8 specific).

typescript
interface LiteralStringValue {
literalString: string;
}
Basic

Basic example of implementing A2UI v0.8 protocol with XCard. Demonstrates how to use XAgentCommand_v0_8 commands to create an interactive card for a coffee booking scenario.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Progressive

Progressive loading example of implementing A2UI v0.8 protocol with XCard. Demonstrates how to load product data in batches and progressively update components using surfaceUpdate commands to achieve smooth loading animations.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Streaming

Streaming content and real-time updates example implementing A2UI v0.8 protocol with XCard. Demonstrates streaming display of AI recommendation results, progressive component loading animations, and loading progress indicators.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Nested Interaction

Complex interaction and nested components example implementing A2UI v0.8 protocol with XCard. Demonstrates expandable detail cards, tree file browser, and accordion folding panels.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Multi Card Sync

Multi-card coordination and state synchronization example implementing A2UI v0.8 protocol with XCard. Demonstrates data sharing between multiple Surfaces, cross-card communication, and real-time price calculation in a shopping cart scenario.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Filter Search

Dynamic data filtering and search example implementing A2UI v0.8 protocol with XCard. Demonstrates how to use antd components for real-time search, multi-condition filtering, and dynamic result updates.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Form Validation

Form validation and error handling example implementing A2UI v0.8 protocol with XCard. Demonstrates how to use antd Form components for real-time validation, error state management, and multi-step form workflows.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code