You can customize the user interface of your AI chatbot to match your brand and provide an optimal user experience.
The kit includes several pre-built UI components made with React and Tailwind CSS.
The UI components are responsible for:
It relies on the AI Engine for state management and data flow, allowing you to focus on customizing the look and feel.
Each scenario has its own set of UI components tailored to the specific use case. Components with the same name across scenarios have similar functionality but different styling and behavior.
Screenshot of the Customer Service UI in fullscreen mode
Screenshot of the Customer Service UI in collapsed chat bubble mode
Located in /components/customer-service/ui/
Features:
Features:
Features:
Features:
Features:
Features:
Features:
Located in /components/wellness-center/ui/
Features:
Features:
Override existing components by creating new versions in your scenario folder:
// /components/your-scenario/ui/ChatMessage.jsx import { aiEngine } from "@/store/aiEngine"; export const ChatMessage = ({ message }) => { return ( <div className="your-custom-message-styles"> {/* Your custom message layout */} </div> ); };
Modify Tailwind classes directly in components:
// Before <button className="bg-blue-500 text-white"> {/* After - Custom brand colors */} <button className="bg-purple-600 text-white">
Customize UI settings in your SceneConfig:
// SceneConfig.js export const SceneConfig = { scenario: "your-scenario", uiSettings: { assistantName: "Your AI Assistant", assistantImage: "/images/your-scenario/profile.jpg", loadingScreenImage: "/images/your-scenario/loading.webp", }, // ... other settings };
Follow the existing patterns when creating new components:
// /components/your-scenario/ui/YourCustomComponent.jsx import { aiEngine } from "@/store/aiEngine"; export const YourCustomComponent = () => { // Access AI Engine state const someState = aiEngine((state) => state.someProperty); return ( <div className="your-component-styles">{/* Your component JSX */}</div> ); };
All UI components integrate with the AI Engine for state management:
import { aiEngine } from "@/store/aiEngine"; export const YourComponent = () => { // Read state const messages = aiEngine((state) => state.conversation); const isLoading = aiEngine((state) => state.loading); // Call actions const sendMessage = aiEngine((state) => state.sendMessage); const setMode = aiEngine((state) => state.setMode); return <div>{/* Use state and actions in your component */}</div>; };
// Using Framer Motion for custom animations import { motion } from "motion/react"; <motion.div initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.3 }} > Your animated content </motion.div>;
// Mobile-first responsive design <div className=" flex flex-col gap-2 // Mobile: column layout md:flex-row md:gap-4 // Desktop: row layout p-4 md:p-6 // Responsive padding ">
// Theme-aware components <div className=" bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 border-gray-200 dark:border-gray-700 ">
The components use React Icons for consistent iconography:
import { IoArrowUpSharp } from "react-icons/io5"; import { CgSpinner } from "react-icons/cg"; import { PiWaveformBold } from "react-icons/pi"; // Usage in components <IoArrowUpSharp className="w-4 h-4" />;
Build complex UIs by composing smaller components:
export const ComplexChatInterface = () => { return ( <div className="flex flex-col h-full"> <ChatHeader /> <ChatConversation /> <ChatInput /> </div> ); };
Keep UI state separate from business logic:
// UI state (local) const [isExpanded, setIsExpanded] = useState(false); // Business state (AI Engine) const messages = aiEngine((state) => state.conversation);
The UI system is designed to be flexible and maintainable, allowing you to create unique experiences while leveraging the robust foundation provided by Chatbot Kit.