Skip to main content
The CometChatSmartReplies component displays AI-generated reply suggestions as clickable chips. It integrates with the CometChat AI extension to analyze the last received message and generate up to 3 contextual reply options.

Overview

The Smart Replies component provides intelligent reply suggestions:
  • AI-Generated Replies: Fetches up to 3 reply suggestions from the CometChat AI extension based on the last received message
  • Trigger Keywords: Only shows suggestions when the message contains configurable trigger keywords (default: what, when, why, who, where, how, ?)
  • Configurable Delay: Waits a configurable duration (default: 10 seconds) before showing suggestions, giving users time to type their own response
  • Loading State: Displays a loading indicator while fetching suggestions from the AI service
  • Keyboard Accessible: Full keyboard navigation with Tab, Enter/Space to select, and ArrowLeft/ArrowRight between replies
Live Preview — default smart replies preview. Open in Storybook ↗

Basic Usage

Simple Smart Replies

With Custom Keywords and Delay

Properties

Events

Customization

CSS Variables

The Smart Replies component uses BEM-style CSS classes that can be customized with CSS variables:

Accessibility

Keyboard Navigation

  • Tab: Focus moves into the smart replies container and to the first reply chip
  • ArrowRight / ArrowLeft: Navigate between reply chips with wrap-around
  • Enter / Space: Select the focused reply chip, emitting the replyClick event
  • Focus is managed using a roving tabindex pattern

Screen Reader Support

  • The container has role="group" with aria-label="Smart replies"
  • Each reply chip has an aria-label with the reply text
  • Screen readers announce “Smart replies available” when the component appears