The component registry is the heart of Adaptly. It tells the AI about your components, their capabilities, and how they should be used. This guide covers everything you need to know about configuring your components for AI understanding.
The component registry is defined in adaptly.json and serves as a bridge between your React components and the AI. It provides the AI with:
- Component descriptions - What each component does
- Property definitions - What props are available and their types
- Use cases - When and why to use each component
- Space requirements - How much space each component needs
{
"version": "1.0.0",
"components": {
"ComponentName": {
"description": "What this component does",
"props": {
"propName": {
"type": "string",
"required": true,
"allowed": ["option1", "option2"]
}
},
"useCases": ["use case 1", "use case 2"],
"space": {
"min": [2, 1],
"max": [4, 3],
"preferred": [3, 2]
}
}
}
}Every component definition must include:
description- Human-readable description of what the component doesprops- Object defining all available propertiesuseCases- Array of use cases where this component is appropriatespace- Object defining space requirements (min, max, preferred)
{
"props": {
"title": {
"type": "string",
"required": true
},
"value": {
"type": "number",
"required": false
},
"isVisible": {
"type": "boolean",
"required": false
},
"items": {
"type": "array",
"required": false
},
"config": {
"type": "object",
"required": false
}
}
}string- Text valuesnumber- Numeric valuesboolean- True/false valuesarray- Lists of itemsobject- Complex data structures
{
"status": {
"type": "string",
"required": true,
"allowed": ["active", "inactive", "pending"]
},
"priority": {
"type": "number",
"required": false,
"min": 1,
"max": 10
}
}Space requirements tell the AI how much grid space each component needs:
{
"space": {
"min": [2, 1], // Minimum width, height
"max": [4, 3], // Maximum width, height
"preferred": [3, 2] // Preferred width, height
}
}- Minimum: The smallest space the component can function in
- Maximum: The largest space the component should occupy
- Preferred: The ideal space for the component
// Small metric card
"space": { "min": [1, 1], "max": [2, 1], "preferred": [2, 1] }
// Medium chart
"space": { "min": [3, 2], "max": [6, 4], "preferred": [4, 3] }
// Large table
"space": { "min": [4, 3], "max": [6, 8], "preferred": [6, 6] }
// Full-width component
"space": { "min": [6, 2], "max": [6, 4], "preferred": [6, 3] }Use cases help the AI understand when to use each component:
{
"useCases": [
"revenue tracking",
"user metrics",
"performance indicators",
"KPI display",
"dashboard summary"
]
}- Be specific: "revenue tracking" vs "metrics"
- Use common terms: "dashboard", "analytics", "monitoring"
- Include synonyms: "KPI display", "performance indicators"
- Think like a user: What would someone search for?
{
"MetricCard": {
"description": "Display key performance indicators with values, trends, and progress bars",
"props": {
"title": {
"type": "string",
"required": true
},
"value": {
"type": "string",
"required": true
},
"change": {
"type": "string",
"required": false
},
"changeType": {
"type": "string",
"required": false,
"allowed": ["positive", "negative", "neutral"]
},
"progress": {
"type": "number",
"required": false
},
"description": {
"type": "string",
"required": false
}
},
"useCases": [
"revenue tracking",
"user metrics",
"performance indicators",
"KPI display",
"dashboard summary"
],
"space": {
"min": [2, 1],
"max": [3, 2],
"preferred": [2, 1]
}
}
}{
"SalesChart": {
"description": "Visualize sales data with interactive charts and graphs",
"props": {
"title": {
"type": "string",
"required": false
},
"description": {
"type": "string",
"required": false
},
"timeRange": {
"type": "string",
"required": false,
"allowed": ["7d", "30d", "90d", "1y"]
},
"metric": {
"type": "string",
"required": false,
"allowed": ["sales", "revenue", "profit", "orders"]
},
"category": {
"type": "string",
"required": false
},
"sortBy": {
"type": "string",
"required": false,
"allowed": ["date", "value", "growth"]
},
"sortOrder": {
"type": "string",
"required": false,
"allowed": ["asc", "desc"]
}
},
"useCases": [
"sales visualization",
"trend analysis",
"performance charts",
"revenue tracking",
"data visualization"
],
"space": {
"min": [3, 3],
"max": [6, 5],
"preferred": [4, 4]
}
}
}{
"DataTable": {
"description": "Display tabular data with filtering, sorting, and pagination",
"props": {
"title": {
"type": "string",
"required": true
},
"data": {
"type": "array",
"required": true
},
"columns": {
"type": "array",
"required": true
},
"filters": {
"type": "object",
"required": false
},
"sortBy": {
"type": "string",
"required": false
},
"sortOrder": {
"type": "string",
"required": false,
"allowed": ["asc", "desc"]
}
},
"useCases": [
"data display",
"tabular information",
"sortable lists",
"data tables",
"information display"
],
"space": {
"min": [4, 4],
"max": [6, 8],
"preferred": [6, 6]
}
}
}{
"Chart": {
"description": "Interactive chart component with multiple chart types",
"props": {
"type": {
"type": "string",
"required": true,
"allowed": ["line", "bar", "pie", "area"]
},
"data": {
"type": "array",
"required": true
},
"showLegend": {
"type": "boolean",
"required": false
},
"animation": {
"type": "boolean",
"required": false
}
},
"useCases": [
"data visualization",
"chart display",
"analytics",
"trend analysis"
],
"space": {
"min": [3, 3],
"max": [6, 6],
"preferred": [4, 4]
}
}
}{
"UserProfile": {
"description": "Display user information with avatar and contact details",
"props": {
"user": {
"type": "object",
"required": true
},
"showContact": {
"type": "boolean",
"required": false
},
"showStatus": {
"type": "boolean",
"required": false
}
},
"useCases": [
"user profiles",
"team members",
"contact information",
"user display"
],
"space": {
"min": [2, 2],
"max": [3, 3],
"preferred": [2, 2]
}
}
}// Good
"description": "Display key performance indicators with values, trends, and progress bars"
// Bad
"description": "Shows numbers"// Good
"useCases": ["revenue tracking", "user metrics", "performance indicators"]
// Bad
"useCases": ["data", "info", "stuff"]// Good - realistic space requirements
"space": { "min": [2, 1], "max": [3, 2], "preferred": [2, 1] }
// Bad - unrealistic requirements
"space": { "min": [1, 1], "max": [12, 12], "preferred": [6, 6] }// Good
"timeRange": { "type": "string", "allowed": ["7d", "30d", "90d"] }
// Bad
"x": { "type": "string", "allowed": ["a", "b", "c"] }// Good
"status": {
"type": "string",
"allowed": ["active", "inactive", "pending", "archived"]
}
// Bad
"status": {
"type": "string",
"allowed": ["a", "b", "c"]
}// ❌ Missing description
{
"MyComponent": {
"props": { "title": { "type": "string", "required": true } },
"useCases": ["display"],
"space": { "min": [1, 1], "max": [2, 2], "preferred": [1, 1] }
}
}
// ✅ Complete definition
{
"MyComponent": {
"description": "Display component with title",
"props": { "title": { "type": "string", "required": true } },
"useCases": ["display"],
"space": { "min": [1, 1], "max": [2, 2], "preferred": [1, 1] }
}
}// ❌ Inconsistent types
{
"props": {
"count": { "type": "string" }, // Should be number
"active": { "type": "string" } // Should be boolean
}
}
// ✅ Correct types
{
"props": {
"count": { "type": "number" },
"active": { "type": "boolean" }
}
}// ❌ Unrealistic space
"space": { "min": [1, 1], "max": [12, 12], "preferred": [6, 6] }
// ✅ Realistic space
"space": { "min": [2, 1], "max": [4, 3], "preferred": [3, 2] }Adaptly automatically validates your registry. Check the browser console for validation errors:
# Common validation errors
"Component 'MyComponent' must have a description"
"Component 'MyComponent' must have props defined"
"Component 'MyComponent' must have useCases array"
"Component 'MyComponent' must have space requirements"- Press
⌘Kto open the command interface - Try commands that should use your components:
- "Add a metric card"
- "Show me some charts"
- "Create a data table"
- Verify that the AI selects the right components
Enable debug logging to see how the AI processes your registry:
<AdaptlyProvider
// ... other props
logging={{ enabled: true, level: "debug" }}
/>- Create the component in your codebase
- Add to registry in
adaptly.json - Register in AdaptlyProvider:
components={{
MetricCard,
SalesChart,
DataTable,
NewComponent, // Add your new component
}}- Update the registry in
adaptly.json - Update your component if needed
- Test with AI to ensure it still works
- Remove from registry in
adaptly.json - Remove from AdaptlyProvider:
components={{
MetricCard,
SalesChart,
// DataTable removed
}}Now that you understand the component registry:
- Read the LLM Providers Guide to set up multiple AI providers
- Explore Storage Service Guide for persistent state management
- Check out Advanced Features for custom configurations
- See the Demo Application for complete examples
Error: "Component 'MyComponent' must have a description"
- Solution: Add a description field to your component definition
Error: "Component 'MyComponent' must have props defined"
- Solution: Add a props object with at least one property
Error: "Component 'MyComponent' must have useCases array"
- Solution: Add a useCases array with at least one use case
Error: "Component 'MyComponent' must have space requirements"
- Solution: Add space object with min, max, and preferred arrays
Issue: AI not using your components
- Solution: Check that use cases match what users are asking for
- Solution: Ensure descriptions are clear and specific
- Solution: Verify space requirements are realistic
Issue: Component appears in AI response but doesn't render
- Solution: Check that component is properly exported
- Solution: Verify component is registered in AdaptlyProvider
- Solution: Ensure component props match the registry definition
Ready to set up multiple AI providers? Check out the LLM Providers Guide!