> ## Documentation Index
> Fetch the complete documentation index at: https://anvil.servicetitan.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Chat Composer Rich – Code

> ChatComposerRich provides a rich text input for composing chat messages.

> [!WARNING]
>
> Atlas is deprecated. Use [AI Kit](https://anvil.servicetitan.com/docs/building-agentic-experiences) for any new Atlas experiences.

> [tab] Implementation
>
> ext-atlas-chat-composer-rich-demo
>
> [StackBlitz demo](https://stackblitz.com/github/servicetitan/anvil2-docs-live-code/tree/main/examples/ext-atlas-chat-composer-rich-demo?file=src/App.tsx)
>
> ```tsx lines expandable theme={null}
> import { ChatComposerRich } from "@servicetitan/anvil2-ext-atlas";
> import { Card } from "@servicetitan/anvil2";
> import { useState } from "react";
>
> function App() {
>   const [message, setMessage] = useState("");
>
>   return (
>     <Card
>       flexDirection="column"
>       gap={4}
>       background="strong"
>       style={{ width: "388px" }}
>     >
>       <ChatComposerRich
>         message={message}
>         onChange={setMessage}
>         onSend={(text) => {
>           console.log("sent:", text);
>           setMessage("");
>         }}
>         onDictateMessage={() => console.log("dictate clicked")}
>         onUploadFile={() => console.log("upload clicked")}
>         placeholder="Ask anything..."
>       />
>     </Card>
>   );
> }
>
> export default App;
> ```
>
> ## Common Examples
>
> ```tsx theme={null}
> import { ChatComposerRich } from "@servicetitan/anvil2-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:
>
> ```tsx theme={null}
> import { ChatComposerRich } from "@servicetitan/anvil2-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:
>
> ```tsx theme={null}
> import { ChatComposerRich } from "@servicetitan/anvil2-ext-atlas";
>
> function DisabledComposer() {
>   const [isProcessing, setIsProcessing] = useState(false);
>
>   return (
>     <ChatComposerRich
>       message=""
>       onChange={() => {}}
>       onSend={handleSend}
>       disabled={isProcessing}
>       placeholder="Processing your request..."
>     />
>   );
> }
> ```
>
> ### Custom Placeholder
>
> ```tsx theme={null}
> import { ChatComposerRich } from "@servicetitan/anvil2-ext-atlas";
>
> function CustomPlaceholderComposer() {
>   return (
>     <ChatComposerRich
>       message=""
>       onChange={setMessage}
>       onSend={handleSend}
>       placeholder="Type your question here..."
>     />
>   );
> }
> ```

> [tab] ChatComposerRich API
>
> ```tsx theme={null}
> <ChatComposerRich
>   message={message}
>   onChange={setMessage}
>   onSend={handleSend}
>   placeholder="Ask anything..."
>   disabled={false}
>   onUploadFile={handleUpload}
>   onDictateMessage={handleDictate}
> />
> ```
>
> ## `ChatComposerRich` Props
>
> **onChange** `(text: string) =\> void` *required*
>
> Callback fired when the input content changes.
>
> **className** `string`
>
> Additional CSS class name for custom styling.
>
> **disabled** `boolean` (default: false)
>
> When true, disables the entire composer including input and buttons.
>
> **message** `string`
>
> The current value of the input. Used to sync external state with the input.
>
> **onDictateMessage** `() =\> void`
>
> Callback for the "Dictate message" menu action. Menu item only renders when provided.
>
> **onSend** `(text: string) =\> void`
>
> Callback fired when the user submits a message (Enter key or send button).
>
> **onUploadFile** `() =\> void`
>
> Callback for the "Upload file" menu action. Menu item only renders when provided.
>
> **placeholder** `string` (default: Ask anything...)
>
> Placeholder text displayed when the input is empty.
>
> ### Test ID Props
>
> **menuButtonId** `string`
>
> Test ID for the menu button.
>
> **messageInputId** `string`
>
> Test ID for the message input element.
>
> **sendIconId** `string`
>
> Test ID for the send button.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.