Show HN: Plug Generative UI with One Line of Code (Open Source)
4 months ago
6
AgenticGenUI is an open-source library for building AI-powered, generative user interfaces. It provides a comprehensive set of components tailored for AI agent applications, enabling developers to rapidly create interactive, production-ready UIs that seamlessly integrate with large language models or any react based apps.
40+ Specialized Components: Purpose-built UI components for AI agent interfaces
CopilotKit Integration: Seamless compatibility with CopilotKit
Scenario-Based Design: Tailored to real AI agent use cases
Fully Responsive: Desktop, tablet, and mobile support
Accessibility-First: Adheres to a11y best practices
TypeScript Support: Strong typings for all components
Note: AgenticGenUI is not yet available via npm. Use Git to install directly.
# Clone the repository
git clone https://github.com/vivek100/AgenticGenUI.git
# Navigate into the projectcd AgenticGenUI
# Install dependencies
npm install
# Start development server
npm run dev
Explore the full functionality via the included demo app.
Node.js 18.x+
npm 9.x+
Create a .env.local file in the root:
XAI_API_KEY=your_xai_api_key_here
Note: You can run the demo app without api keys too, it has mock mode where it can use fuzzy match of input text message and render the components.
import{MetricCard}from'./agentic-ui/components';functionDashboard(){return(<MetricCardtitle="Active Users"value={1254}change={12.5}changeType="increase"description="Total active users in the last 30 days"icon="users"/>);}
🧠 With CopilotKit Integration
import{CopilotKit}from'@copilotkit/react-core';import{AgentRenderer}from'./components/agent-renderer';import{MetricCardGrid}from'./agentic-ui/components';functionApp(){return(<CopilotKitapiKey="your-api-key"><AgentRenderer><MetricCardGridtitle="Business Overview"metrics={[{title: "Revenue",value: "$12,345",change: 8.2,changeType: "increase",description: "Total revenue this month",icon: "dollar-sign"},{title: "Users",value: "1,234",change: 12.5,changeType: "increase",description: "Active users this month",icon: "users"}]}/></AgentRenderer></CopilotKit>);}
// app/layout.tsximport{CopilotKit}from'@copilotkit/react-core';exportdefaultfunctionRootLayout({ children }: {children: React.ReactNode}){return(<htmllang="en"><body><CopilotKitapiKey={process.env.COPILOT_API_KEY}chatApiEndpoint="/api/copilotkit">{children}</CopilotKit></body></html>);}
// app/api/copilotkit/route.tsimport{createAI}from'@copilotkit/runtime';exportasyncfunctionPOST(req: Request){constbody=awaitreq.json();const{ messages }=body;constai=createAI({/* your AI config */});constresponse=awaitai.chat(messages);returnnewResponse(JSON.stringify(response));}
exportfunctiongetSystemPrompt(){return` You are an AI that generates UI components from user requests. Available components include: - MetricCard - Chart - DataTable ... Respond using JSON with: - type: Component name - props: Component props Example: { "type": "MetricCard", "props": { "title": "Active Users", "value": 1254, "change": 12.5, "changeType": "increase", "description": "Total active users in the last 30 days", "icon": "users" } } `;}
We welcome contributions!
Fork this repo
Create a feature branch
git checkout -b feature/your-feature-name
Commit your changes
git commit -m "Add new feature"
Push your branch
git push origin feature/your-feature-name
Open a Pull Request
Follow the existing code style
Write tests for new components
Update documentation
Ensure tests pass
AgenticGenUI is licensed under the MIT License. See LICENSE for full details.