- Implementation
- UserMessage Props
Common Examples
To use theUserMessage, pass content and a required timestamp. The bubble right-aligns with a 24px left 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. When neither yields text, the copy button is omitted.Content length
Long messages wrap inside the bubble.Error and retry
Passerror to render a line below the bubble. onRetry shows a refresh action only when error is also set.Toolbar
The toolbar always includes copy (when copyable) and the formatted timestamp. SetrevealToolbarOnHover so a chat list can hide the toolbar until hover or focus, typically on every message except the latest. Coarse pointers always show the toolbar. Keyboard focus reveals it.Internationalization
The action toolbar owns these localized strings:ai-kit.messageToolbar.copyai-kit.messageToolbar.copiedai-kit.messageToolbar.retryai-kit.messageToolbar.userActions
content and error before passing them. Mount AiKitIntlProvider inside CartoTheme to switch the toolbar strings.React Accessibility
- The toolbar groups user message actions under a localized name.
- Timestamp is always present in the toolbar.
- Hover-hidden toolbars remain reachable from the keyboard.