Skip to content

Interface: MastraChatProps\<TValues\>

Props for MastraChat.

TValues extends Record<string, unknown> = Record<string, unknown>

optional agentId?: string

Agent to converse with. Defaults to the Mastra plugin’s registered default agent (clientConfig().defaultAgent).

UseMastraChatOptions.agentId


optional className?: string

Extra classes merged onto the chat’s root layout container.


optional composerActions?: ReactNode

Host controls placed beside the model picker in the composer footer.


optional composerLeadingActions?: ReactNode

Host controls placed on the left side of the composer footer.


optional enableClear?: 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.

UseMastraChatOptions.enableClear


optional enableExport?: 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.

UseMastraChatOptions.enableExport


optional enableFeedback?: 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.

UseMastraChatOptions.enableFeedback


optional enableThreads?: 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.

UseMastraChatOptions.enableThreads


optional modelSelectorActions?: ReactNode

Host controls shown inside the model selector after its endpoint choices.


optional requestContext?: MastraRequestContextSource<TValues>

Typed application metadata forwarded through Mastra’s native requestContext field. A resolver is read when each turn is submitted.

UseMastraChatOptions.requestContext


optional showModelPicker?: 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.

UseMastraChatOptions.showModelPicker


optional suggestions?: 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.

UseMastraChatOptions.suggestions


optional threadHistoryLeadingActions?: ReactNode

Host controls rendered immediately before the responsive History action.


optional threadPlacement?: 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).

UseMastraChatOptions.threadPlacement


optional threadSidebarHeaderActions?: ReactNode

Host controls rendered in the full conversation-list header.