Skip to main content
Version: 1.0.3

AIChat

The AIChat container organizes visual components (AIMessages, AIChatInput, AIThinkingIndicator, and AISuggestedActions) into a responsive layout. It manages message logs, handles thinking states, displays suggested actions when empty, and provides customizable slots for custom headers, sidebars, attachments, and footer captions.

History

Today

React Router Hook

Yesterday

SaaS Growth Ideas
Ignix AssistantReady for instructions

How can I help you today?

Select a prompt starter suggestion below or enter a prompt inside the input message bar.

Code sync hookWrite router-synchronized state React hook.
SaaS growth ideasBrainstorm creative marketing growth loops.
AI answers may contain errors. Please verify component configurations.

Installation

ignix add component ai-chat

Usage

Import the component:

import { AIChat } from '@mindfiredigital/ignix-ui';

Basic Usage

import { AIChat } from '@mindfiredigital/ignix-ui';
import { useState } from 'react';

function SimpleAssistant() {
const [messages, setMessages] = useState([
{ id: '1', role: 'assistant', content: 'Hello! Ask me anything.' }
]);
const [input, setInput] = useState('');

const handleSend = (text: string) => {
setMessages(prev => [...prev, { id: Date.now().toString(), role: 'user', content: text }]);
setInput('');
};

return (
<AIChat
messages={messages}
inputValue={input}
onInputChange={setInput}
onSend={handleSend}
/>
);
}

Slot Configurations

Utilize the custom slot parameters to append side controls, header titles, and footer legal info:

import { AIChat } from '@mindfiredigital/ignix-ui';
import { Bot, Settings } from 'lucide-react';

function CustomWorkspace() {
return (
<AIChat
messages={messages}
inputValue={input}
onInputChange={setInput}
onSend={handleSend}
// Custom Header Slot
headerSlot={
<div className="flex justify-between items-center w-full">
<div className="flex items-center gap-2">
<Bot className="text-indigo-500" />
<span className="font-bold text-sm">Workspace Copilot</span>
</div>
<Settings size={16} className="cursor-pointer text-neutral-400" />
</div>
}
// Custom Footer Info
footerSlot="Copilot answers may contain inaccuracies. Please double check vital outputs."
/>
);
}

Props

ParameterTypeDefaultDescription
messagesAIMessagesItem[][]Message list logs to render in the scrollable viewport.
isThinkingbooleanfalseRenders a loading ellipsis thinking indicator below messages.
inputValuestringText content value of the chat textarea.
onInputChange(value: string) => voidCallback fired when the input textarea changes.
onSend(value: string) => voidCallback fired when input text query is sent/submitted.
isStreamingbooleanfalseSets a streaming state, changing send button into a stop trigger.
suggestedActionsSuggestedAction[][]Prompt template actions displayed when no messages are logged.
variant'default' | 'dark' | 'glass' | 'minimal''default'Theme variants.
headerSlotReactNodeAppended slot to render customizable headers.
footerSlotReactNodeCaptions or copy subtext below the input bar.
attachmentSlotReactNodeComponent placement slot inside the input textarea.