@ai-slot/adapter-react
v0.1.3
Published
React renderer adapter for ai-slot: render validated component trees as real React components.
Readme
@ai-slot/adapter-react
English | 简体中文
React renderer adapter for ai-slot-component: render validated component trees as real React components, plus an <AiSlot> wrapper around the Web Component.
Install
npm install @ai-slot/adapter-react
# peer deps: react >= 18, react-dom >= 18Usage
import { AiSlot, treeToReact } from "@ai-slot/adapter-react";
// 1. Map component-tree nodes to your React components
const tree = treeToReact({ Banner }, modelOutput);
// 2. Or use the wrapper — plain markup inside is the fallback
<AiSlot name="hero" src="/ai-render/hero" stream>
<h1>Original content</h1>
</AiSlot>Docs
License
MIT
