Skip to main content
For development, import AgentMessage from @servicetitan/anvil2-ai-kit. For design, find it in the AI Kit Web Component Library file.

Common Examples

To use the AgentMessage, pass content and a required timestamp. The row left-aligns the content and reserves a 24px inline-end gutter. The kit forbids children.
content accepts a string, inline markup, or a Markdown tree. Copy is text-only: pass copyText when content is rich so the copy action stays available.

Toolbar

Set revealToolbarOnHover on every message except the latest agent message. The hidden toolbar appears when the pointer is over the message, or when focus moves into the toolbar. Focus inside the message content keeps it hidden. Coarse pointers always show the toolbar.

Feedback

Wire onLike and onDislike to show thumbs. The component reflects currentFeedback; toggling is yours. When feedback is set, the toolbar shows a confirmation line.Omit both handlers to hide feedback entirely.

Internationalization

The action toolbar owns these localized strings:
  • ai-kit.messageToolbar.copy
  • ai-kit.messageToolbar.copied
  • ai-kit.messageToolbar.like
  • ai-kit.messageToolbar.removeLike
  • ai-kit.messageToolbar.dislike
  • ai-kit.messageToolbar.removeDislike
  • ai-kit.messageToolbar.feedbackThanks
  • ai-kit.messageToolbar.assistantActions
Localize content before passing it. Mount AiKitIntlProvider inside CartoTheme to switch the toolbar strings.

React Accessibility

  • The toolbar groups assistant actions under a localized name.
  • Timestamp is always present in the toolbar.
  • Feedback buttons announce like, dislike, and selected state.
  • Hover-hidden toolbars remain reachable from the keyboard. Focusing a toolbar action reveals the toolbar. Focusing a control in the message content does not.
Last modified on October 28, 2026