A2UISurface
import { A2UIActionSummary, A2UISurface, A2UI_CATALOG_DESCRIPTION, HANZO_A2UI_SYSTEM_PROMPT, formatA2UIActionMessage } from '@hanzo/ui/a2ui'
Interactive Workbench
Switch presets, edit A2UI 1.0 JSON live, inspect zero-trust action payloads, and view compiled @hanzo/ui TSX.
export function InteractiveWorkbench() {
const [presetId, setPresetId] = useState(PRESETS[0]!.id)
const preset = PRESETS.find((p) => p.id === presetId) ?? PRESETS[0]!
return (
<YStack width="100%" gap="$3">
<XStack flexWrap="wrap" gap="$2">
{PRESETS.map((p) => (
<Button
key={p.id}
size="sm"
variant={p.id === preset.id ? 'secondary' : 'outline'}
onPress={() => setPresetId(p.id)}
>
{p.label}
</Button>
))}
</XStack>
<A2UIWorkbench title={preset.title} initialPayload={preset.payload} />
</YStack>
)
}Standalone Surface
Render any A2UI 1.0 message directly and receive zero-trust action events.
Schedule Release
Card + DateTimeInput + ChoicePicker + Button · undeclared dataModel keys stay private.
@hanzo/ui@8.35.1CI Greenexport function StandaloneSurface() {
const [last, setLast] = useState<A2UIActionEvent | null>(null)
return (
<YStack width="100%" gap="$3">
<A2UISurface
payload={PRESETS[0]!.payload}
onAction={(ev) => setLast(ev)}
/>
{last ? (
<Text fontFamily="$mono" fontSize="$2" color="$color11">
{JSON.stringify({ surfaceId: last.surfaceId, name: last.name, context: last.context })}
</Text>
) : null}
</YStack>
)
}Types
export interface A2UISurfaceProps {
/** Raw JSON/JSONL/markdown string, A2UI message(s), or pre-parsed surface state(s). */
payload: string | A2UIMessage | A2UIMessage[] | A2UISurfaceState | A2UISurfaceState[]
/** Zero-trust action callback invoked with ONLY explicitly declared context values. */
onAction?: (event: A2UIActionEvent) => void
/** Optional custom or override components merged on top of `defaultA2UICatalog`. */
catalog?: Partial<A2UICatalog>
/** Disable all interactive inputs and action triggers. */
readOnly?: boolean
/** Optional CSS class on the outer container. */
className?: string
/** Optional inline styles on the outer container. */
style?: React.CSSProperties
/** Optional callback fired whenever a surface's local `dataModel` changes. */
onDataModelChange?: (surfaceId: string, dataModel: Record<string, unknown>) => void
/** Show a subtle badge for unknown component types instead of silently omitting them. */
showUnknownFallback?: boolean
}export interface A2UIActionSummaryProps {
event: A2UIActionEvent
className?: string
}Exports
A2UIActionSummaryA2UISurfaceA2UI_CATALOG_DESCRIPTIONHANZO_A2UI_SYSTEM_PROMPTformatA2UIActionMessagetype A2UIActionSummaryPropstype A2UISurfaceProps