Common props ref: Common Props
Box component serves as a container to manage Card instances and command dispatching.
| Property | Description | Type | Default | Version |
|---|---|---|---|---|
| children | Child elements | React.ReactNode | - | - |
| components | Custom component mapping, component names must start with uppercase letters | Record<string, React.ComponentType<any>> | - | - |
| commands | A2UI command object | A2UICommand_v0_9 | XAgentCommand_v0_8 | - | - |
| onAction | Callback function when action is triggered inside Card | (payload: ActionPayload) => void | - | - |
Card component is used to render a single Surface.
| Property | Description | Type | Default | Version |
|---|---|---|---|---|
| id | Surface ID, corresponding to surfaceId in commands | string | - | - |
Data structure for action events.
| Property | Description | Type | Default | Version |
|---|---|---|---|---|
| name | Event name | string | - | - |
| surfaceId | The surfaceId that triggered the action | string | - | - |
| context | Complete dataModel snapshot of current surface | Record<string, any> | - | - |
Command type for v0.9 version, supporting the following commands:
Create a new Surface.
| Property | Description | Type | Default | Version |
|---|---|---|---|---|
| version | Version number | 'v0.9' | - | - |
| createSurface.surfaceId | Surface ID | string | - | - |
| createSurface.catalogId | Component catalog URL or local identifier | string | - | - |
Update components on a Surface.
| Property | Description | Type | Default | Version |
|---|---|---|---|---|
| version | Version number | 'v0.9' | - | - |
| updateComponents.surfaceId | Surface ID | string | - | - |
| updateComponents.components | Component list | BaseComponent_v0_9[] | - | - |
interface BaseComponent_v0_9 {id: string;component: string;child?: string;children?: string[];[key: string]: any | PathValue;}
Update data model.
| Property | Description | Type | Default | Version |
|---|---|---|---|---|
| version | Version number | 'v0.9' | - | - |
| updateDataModel.surfaceId | Surface ID | string | - | - |
| updateDataModel.path | Data path | string | - | - |
| updateDataModel.value | Data value | any | - | - |
Delete a Surface.
| Property | Description | Type | Default | Version |
|---|---|---|---|---|
| version | Version number | 'v0.9' | - | - |
| deleteSurface.surfaceId | Surface ID | string | - | - |
Data binding path object.
interface PathValue {path: string;}
Component catalog definition.
interface Catalog {$schema?: string;$id?: string;title?: string;description?: string;catalogId?: string;components?: Record<string, CatalogComponent>;functions?: Record<string, any>;$defs?: Record<string, any>;}
Component definition in Catalog.
interface CatalogComponent {type: 'object';allOf?: any[];properties?: Record<string, any>;required?: string[];[key: string]: any;}
Register a local catalog.
registerCatalog(catalog: Catalog): void
Load a catalog (supports remote URL or locally registered schema).
loadCatalog(catalogId: string): Promise<Catalog>
Validate whether a component conforms to catalog definition.
validateComponent(catalog: Catalog, componentName: string, componentProps: Record<string, any>): boolean
Clear catalog cache.
clearCatalogCache(): void