Skip to main content

Where It Fits

CometChatOutgoingCall is an overlay component that displays the outgoing call screen with the recipient’s name, avatar, and a cancel button. It plays a ringtone while the call is pending. Typically rendered at the app root level after initiating a call via CometChat.initiateCall().

Minimal Render

Root CSS class: .cometchat-outgoing-call

Actions and Events

Callback Props

onCallCanceled

Fires when the cancel button is clicked. Pauses the ringtone internally before invoking the callback.

onError

Fires on internal errors.

Global UI Events

CometChatCallEvents emits call lifecycle events subscribable from anywhere. Subscribe in a useEffect and unsubscribe on cleanup.
EventFires whenPayload
ccOutgoingCallA call is initiatedCometChat.Call
ccCallAcceptedThe recipient accepts the callCometChat.Call
ccCallRejectedThe recipient rejects the callCometChat.Call
ccCallEndedThe call session endsCometChat.Call

SDK Events (Real-Time, Automatic)

The component internally manages call sound playback. It plays the outgoing call ringtone on mount (unless disableSoundForCalls={true}) and pauses it on unmount or cancel. No SDK call listeners are attached by the component itself — call status updates are handled by the parent application.

Custom View Slots

All view slots on CometChatOutgoingCall are JSX.Element (not functions). They do not receive parameters — pass call data via closure if needed.
SlotTypeReplaces
titleViewJSX.ElementRecipient name
subtitleViewJSX.Element”Calling…” text
avatarViewJSX.ElementRecipient avatar
cancelButtonViewJSX.ElementCancel call button

titleView

Replace the recipient name.

subtitleView

Replace the “Calling…” text.

avatarView

Replace the recipient avatar.

cancelButtonView

Replace the cancel call button.

Common Patterns

Cancel and end the call session

Custom ringtone

Silent outgoing call (no ringtone)


CSS Architecture

The component uses CSS custom properties (design tokens) defined in @cometchat/chat-uikit-react/css-variables.css. The cascade:
  1. Global tokens (e.g., --cometchat-primary-color, --cometchat-error-color) set on the .cometchat root wrapper.
  2. Component CSS (.cometchat-outgoing-call) consumes these tokens via var() with fallback values.
  3. Overrides target .cometchat-outgoing-call descendant selectors in a global stylesheet.

Key Selectors

TargetSelector
Root.cometchat-outgoing-call
Title container.cometchat-outgoing-call__title-container
Title text.cometchat-outgoing-call__title
Subtitle text.cometchat-outgoing-call__subtitle
Avatar container.cometchat-outgoing-call__avatar
Avatar image.cometchat-outgoing-call__avatar .cometchat-avatar
Avatar text.cometchat-outgoing-call__avatar .cometchat-avatar__text
Cancel button wrapper.cometchat-outgoing-call__button
Cancel button.cometchat-outgoing-call__button .cometchat-button
Cancel button icon.cometchat-outgoing-call__button .cometchat-button .cometchat-button__icon

Example: Themed outgoing call

Customization Matrix

What to changeWhereProperty/APIExample
Handle cancel actionComponent propsonCallCanceledonCallCanceled={() => endCall()}
Disable ringtoneComponent propsdisableSoundForCallsdisableSoundForCalls={true}
Custom ringtoneComponent propscustomSoundForCallscustomSoundForCalls="/sounds/ring.mp3"
Replace UI sectionsComponent propsView slot propstitleView={<div>Custom</div>}
Change colors, fonts, spacingGlobal CSSTarget .cometchat-outgoing-call class.cometchat-outgoing-call__title { color: red; }

Props

All props are optional unless noted. Sorted alphabetically.

avatarView

Custom JSX replacing the recipient avatar.
TypeJSX.Element
DefaultBuilt-in avatar

call

The outgoing call object from CometChat.initiateCall().
TypeCometChat.Call
Defaultundefined
Component renders nothing when call is not provided.

cancelButtonView

Custom JSX replacing the cancel call button.
TypeJSX.Element
DefaultBuilt-in cancel button

customSoundForCalls

URL to a custom audio file for the outgoing call ringtone.
Typestring
DefaultBuilt-in ringtone

disableSoundForCalls

Disables the outgoing call ringtone.
Typeboolean
Defaultfalse

onCallCanceled

Callback fired when the cancel button is clicked.
TypeFunction
Defaultundefined

onError

Callback fired when the component encounters an error.
Type((error: CometChat.CometChatException) => void) | null
Defaultundefined

subtitleView

Custom JSX replacing the “Calling…” subtitle text.
TypeJSX.Element
DefaultBuilt-in subtitle

titleView

Custom JSX replacing the recipient name.
TypeJSX.Element
DefaultBuilt-in title

Events

EventPayloadFires when
CometChatCallEvents.ccOutgoingCallCometChat.CallCall initiated
CometChatCallEvents.ccCallAcceptedCometChat.CallRecipient accepts
CometChatCallEvents.ccCallRejectedCometChat.CallRecipient rejects
CometChatCallEvents.ccCallEndedCometChat.CallCall session ends
All events are Subject<CometChat.Call> from RxJS. Subscribe with .subscribe(), unsubscribe with the returned subscription’s .unsubscribe().

CSS Selectors

TargetSelector
Root.cometchat-outgoing-call
Title container.cometchat-outgoing-call__title-container
Title text.cometchat-outgoing-call__title
Subtitle text.cometchat-outgoing-call__subtitle
Avatar container.cometchat-outgoing-call__avatar
Avatar image.cometchat-outgoing-call__avatar .cometchat-avatar
Avatar text.cometchat-outgoing-call__avatar .cometchat-avatar__text
Cancel button wrapper.cometchat-outgoing-call__button
Cancel button.cometchat-outgoing-call__button .cometchat-button
Cancel button icon.cometchat-outgoing-call__button .cometchat-button .cometchat-button__icon