This widget is and is subject to change in minor versions.
Signature
Import
JavaScript
About this widget
<Chat> is a widget to display a chat interface that interacts with a generative AI assistant.
See also: Agent Studio
Examples
JavaScript
Props
The unique identifier of the agent to connect to. You can find the
agentId in the Agent Studio dashboard.JavaScript
A custom transport object to handle the communication between the chat widget and the agent. The API endpoint must be compatible with Vercel AI SDK 5.
A function to return the URL of the main search page with the
nextUiState. This is used to navigate to the main search page when the user clicks on “View all” in the search tool.JavaScript
An object defining the client-side tools that the agent can use to interact with your application. A tool’s name must match what is defined in the Agent Studio dashboard.
Components to customize the rendering of the widget.
itemComponent. Custom component for each result. Receives an object containing a single record.headerCloseIconComponent. Header: close icon component.headerMaximizeIconComponent. Header: maximize icon component. Receives a prop containing{ maximized: boolean }for conditional rendering.headerMinimizeIconComponent. Header: minimize icon component.headerTitleIconComponent. Header: title icon component (defaults to sparkles).messagesErrorComponent. Messages: custom error component.messagesLoaderComponent. Messages: custom loader component.assistantMessageLeadingComponent. Assistant message: custom leading component (e.g. avatar).assistantMessageFooterComponent. Assistant message: custom footer component.userMessageLeadingComponent. User message: custom leading component (e.g. avatar).userMessageFooterComponent. User message: custom footer component.promptFooterComponent. Prompt: custom footer component.promptHeaderComponent. Prompt: custom header component.toggleButtonIconComponent. Toggle button: custom icon component. Receives a prop containing{ isOpen: boolean }for conditional rendering.
JavaScript
The CSS classes you can override and pass to the widget’s elements.
It’s useful to style widgets with class-based CSS frameworks like Bootstrap or Tailwind CSS.
root. The root element of the widget.container. The container element.header. The header section of the widget.root. The root element.clear. The clear button.close. The close button.maximize. The maximize button.title. The title element.titleIcon. The title icon element.
messages. The messages section of the widget.root. The root element.content. The scrollable content.scroll. The scroll container.scrollToBottom. The scroll to bottom button.scrollToBottomHidden. The hidden state of the scroll to bottom button.
message. The message in the messages section.root. The root element.container. The message container.leading. The leading element (e.g., avatar).content. The content element.message. The message text element.actions. The action buttons container.footer. The footer element.
prompt. The prompt section of the widget.root. The root element.actions. The actions container.body. The body element.footer. The footer element.header. The header element.submit. The submit button.textarea. The textarea element.
toggleButton. The toggle button of the widget.root. The root element.
JavaScript
A dictionary of translations to customize the UI text and support internationalization.
header. The header section of the widget.clearLabel. Accessible label for the clear button.closeLabel. Accessible label for the close button.maximizeLabel. Accessible label for the maximize button.minimizeLabel. Accessible label for the minimize button.title. Title to display.
messages. The messages section of the widget.copyToClipboardLabel. Accessible label for the copy to clipboard action.loaderText. Text to display in the loader.regenerateLabel. Accessible label for the regenerate action.scrollToBottomLabel. Accessible label for the scroll to bottom button.
message. Individual message in the messages section.messageLabel. Accessible label for the message.actionsLabel. Accessible label for the actions container.
prompt. The prompt section of the widget.disclaimer. Disclaimer text shown in the prompt footer.emptyMessageTooltip. Tooltip for the submit button when message is empty.sendMessageTooltip. Tooltip for the send button.stopResponseTooltip. Tooltip for the stop button.textareaLabel. Accessible label for the textarea.textareaPlaceholder. Placeholder text for the textarea.
JavaScript
Any
<div> prop to forward to the root element of the widget.JavaScript