Skip to main content
Version: 1.0.3

AIChatInput

AIChatInput is a controlled, auto-growing textarea built for chat-style AI interfaces. It supports Enter to send, Shift+Enter for a newline, a streaming state that swaps the send button for a stop button, and an attachment slot for custom controls like a file-attach button.

Installation

ignix add component ai-chat-input

Usage

Import the component:

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

Basic Usage

function BasicChatInput() {
const [value, setValue] = useState('');

return (
<AIChatInput
value={value}
onChange={setValue}
onSend={(message) => {
console.log(message);
setValue('');
}}
/>
);
}

Streaming State

<AIChatInput
value={value}
onChange={setValue}
onSend={handleSend}
isStreaming={isStreaming}
onStop={handleStop}
/>

Attachment Slot

<AIChatInput
value={value}
onChange={setValue}
onSend={handleSend}
attachmentSlot={
<button aria-label="Attach file" onClick={openFilePicker}>
<Paperclip size={16} />
</button>
}
/>

Props

PropTypeDefaultDescription
valuestringCurrent textarea value (required, controlled)
onChange(value: string) => voidCalled on every keystroke (required)
onSend(value: string) => voidCalled with the trimmed value on Enter or send click (required)
onStop() => voidundefinedCalled when the stop button is clicked while streaming
isStreamingbooleanfalseShows a stop button instead of send; suppresses Enter-to-send
variant'default' | 'dark' | 'glass' | 'minimal''default'Surface style
minRowsnumber1Minimum visible rows before the textarea starts growing
maxRowsnumber6Maximum rows before the textarea scrolls internally
attachmentSlotReact.ReactNodeundefinedRendered to the left of the send/stop button
disabledbooleanfalseDisables the textarea and send button
placeholderstring'Message...'Placeholder text