CometChatConversationStarter component displays AI-generated conversation starter suggestions as clickable chips. It integrates with the CometChat AI extension to generate up to 4 contextual prompts for starting a conversation.
Overview
The Conversation Starter component helps users initiate conversations:- AI-Generated Starters: Fetches up to 4 conversation starter suggestions from the CometChat AI extension
- Context-Aware: Generates starters based on the user or group context provided
- Loading State: Displays a loading indicator while fetching suggestions from the AI service
- Error Handling: Manages error states gracefully when the AI service is unavailable
- Keyboard Accessible: Full keyboard navigation with Tab, Enter/Space to select, and ArrowLeft/ArrowRight between starters with wrap-around
Live Preview — default conversation starter preview.
Open in Storybook ↗
Basic Usage
With a User
With a Group
Properties
| Property | Type | Default | Description |
|---|---|---|---|
user | CometChat.User | undefined | The user context for generating conversation starters. Required for 1-on-1 conversations. |
group | CometChat.Group | undefined | The group context for generating conversation starters. Required for group conversations. |
Events
| Event | Payload Type | Description |
|---|---|---|
starterClick | string | Emitted when a conversation starter chip is clicked. The payload is the starter text that was selected. |
Customization
CSS Variables
The Conversation Starter component uses BEM-style CSS classes that can be customized with CSS variables:Accessibility
Keyboard Navigation
- Tab: Focus moves into the conversation starters container and to the first starter chip
- ArrowRight / ArrowLeft: Navigate between starter chips with wrap-around
- Enter / Space: Select the focused starter chip, emitting the
starterClickevent - Focus is managed using a roving tabindex pattern
Screen Reader Support
- The container has
role="group"witharia-label="Conversation starters" - Each starter chip has an
aria-labelwith the starter text - Screen readers announce “Conversation starters available” when the component appears
Related Components
- CometChatSmartReplies - AI-generated smart reply suggestions for received messages
- CometChatMessageList - Message list that hosts the conversation starter component