logoAnt Design X

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

A2UI v0.9

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>--

A2UICommand_v0_9

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

CreateSurfaceCommand

Create a new Surface.

PropertyDescriptionTypeDefaultVersion
versionVersion number'v0.9'--
createSurface.surfaceIdSurface IDstring--
createSurface.catalogIdComponent catalog URL or local identifierstring--

UpdateComponentsCommand

Update components on a Surface.

PropertyDescriptionTypeDefaultVersion
versionVersion number'v0.9'--
updateComponents.surfaceIdSurface IDstring--
updateComponents.componentsComponent listBaseComponent_v0_9[]--

BaseComponent_v0_9

typescript
interface BaseComponent_v0_9 {
id: string;
component: string;
child?: string;
children?: string[];
[key: string]: any | PathValue;
}

UpdateDataModelCommand

Update data model.

PropertyDescriptionTypeDefaultVersion
versionVersion number'v0.9'--
updateDataModel.surfaceIdSurface IDstring--
updateDataModel.pathData pathstring--
updateDataModel.valueData valueany--

DeleteSurfaceCommand

Delete a Surface.

PropertyDescriptionTypeDefaultVersion
versionVersion number'v0.9'--
deleteSurface.surfaceIdSurface IDstring--

PathValue

Data binding path object.

typescript
interface PathValue {
path: string;
}

Catalog

Component catalog definition.

typescript
interface Catalog {
$schema?: string;
$id?: string;
title?: string;
description?: string;
catalogId?: string;
components?: Record<string, CatalogComponent>;
functions?: Record<string, any>;
$defs?: Record<string, any>;
}

CatalogComponent

Component definition in Catalog.

typescript
interface CatalogComponent {
type: 'object';
allOf?: any[];
properties?: Record<string, any>;
required?: string[];
[key: string]: any;
}

Catalog Methods

registerCatalog

Register a local catalog.

typescript
registerCatalog(catalog: Catalog): void

loadCatalog

Load a catalog (supports remote URL or locally registered schema).

typescript
loadCatalog(catalogId: string): Promise<Catalog>

validateComponent

Validate whether a component conforms to catalog definition.

typescript
validateComponent(catalog: Catalog, componentName: string, componentProps: Record<string, any>): boolean

clearCatalogCache

Clear catalog cache.

typescript
clearCatalogCache(): void
Basic

Basic example of implementing A2UI v0.9 protocol with XCard. Demonstrates how to use XAgentCommand_v0_9 commands with a local catalog.json to create an interactive card for a coffee booking scenario. The v0.9 version introduces a more concise command structure and catalog mechanism.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Progressive

Progressive loading example of implementing A2UI v0.9 protocol with XCard. Demonstrates how to load product data in batches and progressively update components using updateComponents commands, combined with a loading indicator to show progress and achieve a smooth loading experience.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Streaming

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

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

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

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

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

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

Dynamic data filtering and search example implementing A2UI v0.9 protocol with XCard. Demonstrates how to use antd components with catalog mechanism 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.9 protocol with XCard. Demonstrates how to use antd Form components with catalog mechanism for real-time validation, error state management, and multi-step form workflows.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code