Interface: UseMastraChatOptions\<TValues\>
Options for useMastraChat.
Extended by
Section titled “Extended by”Type Parameters
Section titled “Type Parameters”TValues
Section titled “TValues”TValues extends Record<string, unknown> = Record<string, unknown>
Properties
Section titled “Properties”agentId?
Section titled “agentId?”
optionalagentId?:string
Agent to converse with. Defaults to the Mastra plugin’s registered
default agent (clientConfig().defaultAgent).
enableClear?
Section titled “enableClear?”
optionalenableClear?:boolean
Show the destructive Clear conversation action. Off by default because thread management already provides new/delete controls and most chats do not need a second way to erase the active conversation.
enableExport?
Section titled “enableExport?”
optionalenableExport?:boolean
Enable chat export. Off by default (opt-in). When on, the header shows an “Export” menu for the whole conversation and each assistant bubble shows a per-message export menu. Both offer PDF (via the browser print dialog) and Markdown; charts and data tables are inlined into the export so it renders reliably offline.
enableFeedback?
Section titled “enableFeedback?”
optionalenableFeedback?:boolean
Surface per-message feedback controls (thumbs up/down + a comment modal) that log to MLflow as trace assessments.
Defaults to auto: controls render when the server reports MLflow
feedback is available. Pass false to hide them or true to request
them explicitly. Regardless of this flag, controls only render when the
server reports MLflow logging is enabled (clientConfig.feedbackEnabled)
and the turn produced a trace id.
enableThreads?
Section titled “enableThreads?”
optionalenableThreads?:boolean
Enable built-in conversation (thread) management: the chat tracks a
client-selected thread id, persists it across reloads, lists the
resource’s conversations, and renders a sidebar to switch between
them / start new ones / delete them. On by default. Set false for
the classic single-thread chat anchored to the per-session cookie
(no sidebar, no thread tracking).
Shorthand for threadPlacement: false is "disabled". When both
are passed, enableThreads: false wins.
requestContext?
Section titled “requestContext?”
optionalrequestContext?:MastraRequestContextSource<TValues>
Typed application metadata forwarded through Mastra’s native
requestContext field. A resolver is read when each turn is submitted.
showModelPicker?
Section titled “showModelPicker?”
optionalshowModelPicker?:boolean
Surface the built-in model picker in the header, letting the user
override the serving endpoint per turn (via X-Mastra-Model).
Off by default so the drop-in renders a clean single-model chat;
when false the model catalogue isn’t even fetched.
suggestions?
Section titled “suggestions?”
optionalsuggestions?:string[]
Starter questions shown as one-tap buttons on the empty state.
When omitted, the drop-in auto-sources them from the agent’s
Genie space sample questions (via the plugin’s /suggestions
endpoint); when the agent has no Genie space the empty state
stays bare. Pass an explicit list to override that lookup, or
[] to force no suggestions.
threadPlacement?
Section titled “threadPlacement?”
optionalthreadPlacement?:ThreadPlacement
Where conversation management renders: "left" / "right" dock the list
to that edge, "top" shows the open conversations as an editor-style tab
strip with a history menu, "disabled" turns thread management off, and
the default "auto" picks "right" while the chat is wide enough for a
side panel and "top" once it gets too narrow for one (measured on the
chat’s own width, so an embedded panel decides on its own space).