For development, import
PromptBar from @servicetitan/anvil2-ai-kit. For design, find it in the AI Kit Web Component Library file.Options
PromptBar is controlled — the parent ownsvalue, attachments, and the transcription feed — and derives its mode from them. It supports an attachment row, a voice-transcription entry point, and a customizable disclaimer line.
With Text
Once there’s text, the editor rises to its own row above the controls, and the primary action switches from disabled to send.Attachments
Attachments render as thumbnail tiles in a row above the editor; adding one expands the row and reflows the bar. A tile without athumbnailUrl falls back to showing the file name.
Transcribing
transcription.active switches the bar into a distinct mode: the attach and mic controls are replaced by a Cancel button, an animated waveform, and a Done primary action. Prefer wiring real audio into transcription.source (a MediaStream, an AnalyserNode, or a computed amplitude); fall back to a named preset (ambient / speaking / thinking) only when none is available. Setting transcription.error instead swaps in an error layout — an error icon, the message, and Done dismisses the error and exits.
Disclaimer
A disclaimer line sits below the bar, with a “Learn more” link out to more information.Disabled
disabled dims the whole bar and blocks the editor, attachments, and every action.
Behavior
The editor grows with its content, and the bar reflows as attachments and text come and go.Text Wrapping
Once there’s text, the editor lifts to its own row above the controls and wraps across multiple lines, growing up to 8 rows before it scrolls internally — it never truncates or clips.Usage Guidelines
When to Use
Use the Prompt Bar when:- Composing a message to the agent – The user types a free-form prompt and sends it. Place the Prompt Bar as the composer pinned below the conversation in the Chat Layout.
- Attaching files to a prompt – Attachments show as thumbnail tiles above the editor.
- Dictating a prompt – Transcription mode replaces the editor with a waveform, Cancel, and Done.
- Stopping a response in progress – While a response is in flight, the bar withholds sending. Provide a stop action to switch the primary action to Stop.
When not to use
Avoid using the Prompt Bar for:- Asking a clarifying question with a set of options – Use the Agent Prompt instead, which replaces the Prompt Bar until the user answers.
- Offering follow-up prompts after an agent response – Use the Suggestion instead.
Keyboard Interaction
Users can compose, send, and control transcription using standard keyboard controls.Code
- Implementation
- PromptBar Props
- PromptAttachment
Common Examples
To use thePromptBar, pass controlled value and onChange. Mode is derived from those inputs: idle when the draft is empty, draft when text or attachments are present, and transcribing when transcription.active is true.Draft and send
Enter sends when sending is allowed. Sending is allowed when the draft has trimmed text or attachments, unless you overridecanSend. While isSending is true, sending is withheld. Wire onStop to surface Stop instead of Send.Attachments
Passattachments and wire onAddAttachment and onRemoveAttachment. Each attachment needs a stable id and name. thumbnailUrl fills the tile; without it, the tile shows the name.Transcription
WireonStartTranscription for the mic control. Set transcription.active to enter transcribing mode. Prefer a real MediaStream for the waveform:transcription.error to replace the waveform with an error message. Confirm then dismisses the error and exits transcription.Disclaimer
Omitdisclaimer for the default Atlas notice. Pass { message, linkHref } to customize it, wrapping the linked span in <link>…</link>. Pass null to hide the line.Disabled
disabled disables the whole bar.Internationalization
PromptBar owns these localized strings:ai-kit.promptBar.placeholderai-kit.promptBar.addai-kit.promptBar.removeAttachmentai-kit.promptBar.speakai-kit.promptBar.cancelai-kit.promptBar.sendai-kit.promptBar.stopai-kit.promptBar.doneai-kit.promptBar.dismissai-kit.promptBar.disclaimerai-kit.promptBar.opensInNewTab
placeholder or disclaimer.message on the component, or mount AiKitIntlProvider inside CartoTheme. removeAttachment receives {name}. Disclaimer messages parse as ICU, so escape {, }, and ' if they are literal.React Accessibility
- Controls expose localized accessible names for add, remove, speak, send, stop, cancel, done, and dismiss.
- Attachment remove labels include the attachment name.
- Disclaimer links that open in a new tab include a localized announcement.