Core API Reference
Concise reference for the main public exports from react-actions-chat.
Components
Chat
The composition root for the chat UI. It renders the transcript, persistent actions, and shared input bar.
Props:
initialMessages?: readonly InputMessage[]allowFreeTextInput?: booleanglobals?: ChatGlobalstheme?: 'light' | 'dark' | ChatTheme
MessageList
Transcript component that renders stored messages.
Message
Bubble component that renders message chrome plus built-in message parts such as plain text, markdown text, inline images, and downloadable files.
InputBar
Shared input component used by free-form chat and input-request flows.
Message Model
InputMessage
Message shape accepted by initialMessages and useChatStore().addMessage(...).
Key fields:
id?: numbertype: 'self' | 'other'parts: readonly MessagePart[]rawContent?: stringtimestamp?: DateisLoading?: booleanloadingLabel?: stringuserResponseCallback?: (submission?: InputSubmission) => voidbuttons?: readonly MessageButton[]
Message
Normalized message shape stored in chat state. It always has:
idpartsrawContenttimestamp
MessagePart
Built-in content parts:
textimagefile
createTextPart(text)
Creates a text part for a message.
createMarkdownTextPart(text, markdownOptions?)
Creates a markdown-rendered text part for a message.
Useful option:
syntaxHighlighting?: booleanto colorize fenced code blocks when a language likets,tsx, orjsis present
createImagePart(url, options?)
Creates an inline image part for a message.
Useful options:
alt?: stringto describe the image for assistive technologyfileName?: stringto show the original filename in the transcriptmimeType?: stringto store the image content typemaxWidthPx?: numberto cap the preview width in the transcriptmaxHeightPx?: numberto cap the preview height in the transcriptsizeBytes?: numberto show file-size metadata in the transcript
createFilePart(url, options?)
Creates a downloadable file part for a message.
Useful options:
fileName?: stringto show the original filename in the transcriptmimeType?: stringto store the file content typesizeBytes?: numberto show file-size metadata in the transcript
Button Helpers
createButton(definition, runtimeConfig?)
Creates a plain button or turns a reusable input/confirmation definition into a runtime button.
Supported definition shapes:
- plain button definition
RequestInputButtonDefinitionRequestConfirmationButtonDefinition
createRequestInputButtonDef(config)
Creates a reusable input-request definition.
Useful upload-related config:
inputType?: InputTypeto choose a text, textarea, select, or semantic HTML input modeinputOptions?: readonly InputSelectOption[]to provide dropdown choices wheninputTypeisselectallowFileUpload?: booleanto show the optional upload button during the flowfileValidator?: (file, submission?) => InputValidationResultto accept or reject uploaded files
createRequestConfirmationButtonDef(config)
Creates a reusable confirmation definition.
Input Bar Types
InputBarModeConfig
Public mode settings for the shared input bar:
typeplaceholder?description?options?
InputBarValidationConfig
Public validation settings for the shared input bar:
fileValidator?validator?submitGuard?
InputBarBehaviorConfig
Public behavior settings for the shared input bar:
disabled?disabledPlaceholder?shouldWaitForTurn?cooldownMs?timeoutMs?showAbort?allowFileUpload?