This widget is and is subject to change in minor versions.
<Chat> widget shows a loader while a chat turn is in progress.
The default loader includes a spinner, optional text, and skeleton lines.
Use translations.messages.loaderText to change the text or
loaderComponent to replace the loader.
To change when and where the loader renders, see Control when and where the chat loader shows.
Change the loader text
The default loader doesn’t show any text. Add some withtranslations.messages.loaderText:
React
Change the text by turn phase
Pass a function toloaderText to change the text based on the turn context.
Use phase to identify the current phase:
With reasoning shown, the loader stays hidden while a reasoning step streams, so the
reasoning text only appears in the pause between a finished step and the start of the answer.
React
shouldShowLoader, without defaultValue.
Replace the loader
Use theloaderComponent prop to render your own loading state.
It receives:
translations. The resolved loader translations.context. The same context asloaderTextreceives.inline. Whether the loader renders inside an assistant message. It’struewhenloaderPositionismessage-inlineand an assistant message is available.
React
inline if your custom loader needs different markup or spacing when it appears inside a message.
If you use React InstantSearch 7.30.0 or earlier, use messagesLoaderComponent instead of loaderComponent.
Reuse the default loader
Instead of writing the markup yourself, render the built-inChatMessageLoader and override what you need.
It keeps the default spinner, skeleton lines, and animations.
Pass the received props to ChatMessageLoader, then override translations, className, or any element attribute:
React
Rotate loading messages while the agent is working
Preferphase, since it tracks the current phase of the turn. For long waits within one phase, rotate through a short set of messages:
React