- Implementation
- ChatComposerRich API
Common Examples
Copy
Ask AI
import { ChatComposerRich } from "@servicetitan/ext-atlas";
function BasicComposer() {
const [message, setMessage] = useState("");
const handleSend = (text: string) => {
console.log("Sending:", text);
};
return (
<ChatComposerRich
message={message}
onChange={setMessage}
onSend={handleSend}
/>
);
}
With Action Menu
Enable file upload and voice dictation options:Copy
Ask AI
import { ChatComposerRich } from "@servicetitan/ext-atlas";
function ComposerWithActions() {
const [message, setMessage] = useState("");
return (
<ChatComposerRich
message={message}
onChange={setMessage}
onSend={handleSend}
onUploadFile={() => openFileDialog()}
onDictateMessage={() => startVoiceRecognition()}
/>
);
}
Disabled State
Disable input during processing:Copy
Ask AI
import { ChatComposerRich } from "@servicetitan/ext-atlas";
function DisabledComposer() {
const [isProcessing, setIsProcessing] = useState(false);
return (
<ChatComposerRich
message=""
onChange={() => {}}
onSend={handleSend}
disabled={isProcessing}
placeholder="Processing your request..."
/>
);
}
Custom Placeholder
Copy
Ask AI
import { ChatComposerRich } from "@servicetitan/ext-atlas";
function CustomPlaceholderComposer() {
return (
<ChatComposerRich
message=""
onChange={setMessage}
onSend={handleSend}
placeholder="Type your question here..."
/>
);
}
Copy
Ask AI
<ChatComposerRich
message={message}
onChange={setMessage}
onSend={handleSend}
placeholder="Ask anything..."
disabled={false}
onUploadFile={handleUpload}
onDictateMessage={handleDictate}
/>
ChatComposerRich Props
Callback fired when the input content changes.
Additional CSS class name for custom styling.
When true, disables the entire composer including input and buttons.
The current value of the input. Used to sync external state with the input.
Callback for the “Dictate message” menu action. Menu item only renders when provided.
Callback fired when the user submits a message (Enter key or send button).
Callback for the “Upload file” menu action. Menu item only renders when provided.
Placeholder text displayed when the input is empty.
Test ID Props
Test ID for the menu button.
Test ID for the message input element.
Test ID for the send button.
