A programming framework for agentic AI
AddComponentDropdown Usage Examples
The AddComponentDropdown component is a reusable dropdown that allows users to add components to a gallery. It supports all component types (teams, agents, models, tools, workbenches, terminations).
Basic Usage
import { AddComponentDropdown } from "../../shared";
<AddComponentDropdown
componentType="workbench"
gallery={selectedGallery}
onComponentAdded={handleComponentAdded}
/>;
Advanced Usage with Filtering (MCP Workbenches)
<AddComponentDropdown
componentType="workbench"
gallery={selectedGallery}
onComponentAdded={handleComponentAdded}
size="small"
type="text"
buttonText="+"
showChevron={false}
templateFilter={(template) =>
template.label.toLowerCase().includes("mcp") ||
template.description.toLowerCase().includes("mcp")
}
/>
Props
componentType: The type of component to add (team, agent, model, tool, workbench, termination)gallery: The gallery to add the component toonComponentAdded: Callback when a component is addeddisabled: Whether the dropdown is disabledshowIcon: Whether to show the plus iconshowChevron: Whether to show the chevron down iconsize: Button sizetype: Button typeclassName: Additional CSS classesbuttonText: Custom button texttemplateFilter: Optional filter function for templates
Handler Signature
const handleComponentAdded = (
component: Component<ComponentConfig>,
category: CategoryKey
) => {
// Handle the added component
// Update your gallery/state here
};
Benefits
- Reusability: Use the same component across different views
- Consistency: Same UI/UX everywhere
- Maintainability: Single source of truth for component addition logic
- Flexibility: Configurable with props and filters
- Type Safety: Fully typed with TypeScript