For development, import
AgentMessage from @servicetitan/anvil2-ai-kit. For design, find it in the AI Kit Web Component Library file.- Implementation
- AgentMessage Props
Common Examples
To use theAgentMessage, 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
SetrevealToolbarOnHover 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
WireonLike 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.copyai-kit.messageToolbar.copiedai-kit.messageToolbar.likeai-kit.messageToolbar.removeLikeai-kit.messageToolbar.dislikeai-kit.messageToolbar.removeDislikeai-kit.messageToolbar.feedbackThanksai-kit.messageToolbar.assistantActions
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.