AI Components Demo
Interactive showcase of customizable AI chat components
Message Item Component
3 VariantsMessage Input Component
5 VariantsLive Preview
Modern + ModernAI Assistant
01:30 AM
Hello! I'm your AI assistant. How can I help you today?
You
01:30 AM
Can you explain how these components work?
AI Assistant
01:30 AM
Of course! These are customizable AI chat components. You can choose from different style variants to match your design. Each variant has the same functionality but with different visual styles.
⌘↵to send
Try it out!
- • Type a message and press Enter to send
- • Messages will display using the selected Message Item variant
- • Input uses the selected Message Input variant
- • Switch variants to see different styles instantly
Code Example
ChatInterface.tsx
ModernModern
import { MessageInput } from "@/modules/saas/ai/components/ui/MessageInput/ModernMessageInput";
import { MessageItem } from "@/modules/saas/ai/components/ui/MessageItem/ModernMessageItem";
import { useState } from "react";
export function ChatInterface() {
const [input, setInput] = useState("");
const [messages, setMessages] = useState([
{
id: "1",
role: "assistant",
content: "Hello! How can I help you?"
}
]);
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
if (!input.trim()) return;
// Add user message
const userMessage = {
id: Date.now().toString(),
role: "user",
content: input
};
setMessages([...messages, userMessage]);
setInput("");
// Call AI API here to get response
// then add AI message to messages array
};
return (
<div className="flex flex-col h-screen">
{/* Messages Area */}
<div className="flex-1 overflow-y-auto p-4">
{messages.map((message, index) => (
<MessageItem
key={message.id}
message={message}
isLast={index === messages.length - 1}
/>
))}
</div>
{/* Input Area */}
<div className="border-t p-4">
<MessageInput
value={input}
onChange={setInput}
onSubmit={handleSubmit}
placeholder="Type a message..."
/>
</div>
</div>
);
}Component Features
Message Item (Modern)
- • User and AI avatar display
- • File preview support
- • Timestamp and action buttons
- • Role-based styling
Message Input (Modern)
- • File attachment support
- • Character count display
- • Keyboard shortcuts
- • Loading states
Ready to Build Your AI Chat?
Check out the full documentation to learn how to integrate these components into your application.