What is Generative UI?
Generative UI is the ability for AI agents to dynamically create and manage user interfaces based on natural language input. Instead of static, pre-defined UI flows, the AI selects, renders, and updates React components in response to user requests. With Tambo, you register components with Zod schemas describing their props. The AI treats these components as tools—when a user asks for something, the agent picks the right component and streams the props to render it.How It Works
Tambo converts your React components into tools the AI can call:- Component Registration - You register components with schemas defining their props
- AI Selection - The agent analyzes user input and selects appropriate components
- Prop Streaming - Component props stream in real-time as the AI generates them
- Rendering - Tambo renders the component with the streamed props
Generative vs Interactable Components
Tambo supports two types of components:Generative Components
Render once in response to a message. Best for:- Charts and visualizations
- Data summaries
- One-time displays
- Read-only content
components array passed to TamboProvider.
Interactable Components
Persist and update as users refine requests. Best for:- Shopping carts
- Task boards
- Forms and editors
- Stateful widgets
withTamboInteractable() HOC and can be updated by the AI after rendering. See Interactable Components for details.
Component Schema
The schema defines what props the AI can provide:Schema Best Practices
- Clear descriptions - Add
.describe()to help the AI understand field purposes - Constraints - Use
.min(),.max(),.email(), etc. for validation - Enums for choices - Limit options with
z.enum()instead of free-form strings - Optional with defaults - Provide sensible defaults for optional fields
Loading States
Components render progressively as props stream in. Handle partial data:Component Selection
The AI chooses components based on:- Description - Clear, specific descriptions help the AI make the right choice
- Context - User’s current conversation and previous messages
- Schema - Available props and their types
- Naming - Descriptive component names
Good Descriptions
Multiple Similar Components
When you have related components, differentiate them clearly:Streaming Behavior
Props stream to components in real-time. Arrays and objects are built incrementally:Next Steps
- Learn about Components to understand the component lifecycle
- Explore Interactable Components for persistent, updatable UIs
- See Tools to understand how components relate to tool execution
- Check Streaming for details on handling real-time prop updates