Overview
CometChat UI Kit provides pre-built components that you can use to quickly build a chat experience. Components are organized into three types based on complexity.Component Types
Base Components
Simple UI elements with no business logic. They display data you pass to them.| Component | Purpose |
|---|---|
CometChatAvatar | User/group profile images |
CometChatBadge | Notification counts |
CometChatStatusIndicator | Online/offline status |
CometChatDate | Formatted timestamps |
CometChatReceipt | Message delivery status |
- Swift
Components
UI elements with built-in business logic. They fetch data, handle actions, and emit events.| Component | Purpose |
|---|---|
CometChatUsers | List of users |
CometChatGroups | List of groups |
CometChatConversations | Recent chats list |
CometChatMessageList | Chat messages |
CometChatMessageComposer | Message input |
CometChatMessageHeader | Chat header |
CometChatCallLogs | Call history |
- Swift
Composite Components
Combine multiple components into complete features.| Component | Contains |
|---|---|
CometChatMessages | MessageHeader + MessageList + MessageComposer |
CometChatUsersWithMessages | Users + Messages |
CometChatGroupsWithMessages | Groups + Messages |
CometChatConversationsWithMessages | Conversations + Messages |
- Swift
Actions
Actions define how components respond to user interactions.Predefined Actions
Built-in behaviors that work automatically:- Swift
Custom Actions
Override default behavior with your own logic:- Swift
Events
Events allow components to communicate without direct references. Subscribe to events from anywhere in your app.Available Events
| Event | Triggered When |
|---|---|
ccMessageSent | Message is sent |
ccMessageEdited | Message is edited |
ccMessageDeleted | Message is deleted |
ccMessageRead | Message is read |
ccUserBlocked | User is blocked |
ccUserUnblocked | User is unblocked |
ccGroupCreated | Group is created |
ccGroupDeleted | Group is deleted |
ccGroupMemberAdded | Member added to group |
ccGroupMemberRemoved | Member removed from group |
Subscribe to Events
- Swift
Configurations
Customize nested components within composite components:- Swift
Component Hierarchy
Quick Reference
When to Use Each Type
| Need | Use |
|---|---|
| Display user avatar | CometChatAvatar (Base) |
| Show list of users | CometChatUsers (Component) |
| Complete chat with user selection | CometChatUsersWithMessages (Composite) |
| Custom chat UI | Individual Components |
| Quick integration | Composite Components |
Common Patterns
- Swift
Related
- Component Styling - Customize appearance
- Color Resources - Theme colors
- Getting Started - Initial setup