- Implementation
- ChatHistory Props
- ChatHistoryItem
Common Examples
To use theChatHistory, pass configured conversations through items, handle selection through React Aria’s selection APIs, and use onNewChat to start a conversation.items or pass an empty array to render only the New Chat button.Selected and unread
selectedKeys controls the active conversation. Set unread on an item to add a status dot and localized screen-reader text.Subtitle
Every item requires asubtitle, typically a relative timestamp or last-message stamp. The component renders it verbatim; your application owns formatting and relative-time policy.Overflow
Labels and subtitles truncate to one line. PlaceChatHistory in a height-constrained container so long lists scroll instead of growing the rail.Internationalization
ChatHistory owns these localized strings:ai-kit.chatHistory.newChatai-kit.chatHistory.listai-kit.chatHistory.unreadai-kit.chatHistory.recents
label and subtitle before passing it. Mount AiKitIntlProvider inside CartoTheme to switch the built-in strings.React Accessibility
- React Aria supplies single-selection listbox semantics, arrow-key navigation, and typeahead.
- Each item label is its accessible name;
subtitleis its accessible description. - Unread items include localized hidden text. The visual status dot is decorative.
- Pass
aria-labeloraria-labelledbyto override the localized list name.