Documentation Index Fetch the complete documentation index at: https://cometchat-22654f5b-react-uikit-v7.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
AI Integration Quick Reference
{
"component" : "CometChatConfirmDialog" ,
"package" : "@cometchat/chat-uikit-react" ,
"import" : "import { CometChatConfirmDialog } from \" @cometchat/chat-uikit-react \" ;" ,
"cssImport" : "import \" @cometchat/chat-uikit-react/css-variables.css \" ;" ,
"description" : "A modal confirmation dialog with icon, title, message, and action buttons for destructive or important actions requiring explicit user confirmation." ,
"cssRootClass" : ".cometchat-confirm-dialog" ,
"primaryOutput" : {
"prop" : "onConfirm" ,
"type" : "() => void | Promise<void>"
},
"props" : {
"data" : {
"title" : { "type" : "string" , "default" : "localized 'conversation_delete_title'" },
"message" : { "type" : "string" , "default" : "localized 'conversation_delete_subtitle'" },
"cancelText" : { "type" : "string" , "default" : "localized 'conversation_delete_confirm_no'" },
"confirmText" : { "type" : "string" , "default" : "localized 'conversation_delete_confirm_yes'" },
"errorText" : { "type" : "string" , "default" : "undefined" }
},
"callbacks" : {
"onClose" : { "type" : "() => void" , "default" : "undefined" },
"onConfirm" : { "type" : "() => void | Promise<void>" , "default" : "undefined" },
"onCancel" : { "type" : "() => void" , "default" : "calls onClose" }
},
"behavior" : {
"isOpen" : { "type" : "boolean" , "default" : "undefined (uncontrolled)" },
"closeOnOutsideClick" : { "type" : "boolean" , "default" : "true" },
"variant" : { "type" : "'danger' | 'warning' | 'info'" , "default" : "'danger'" },
"isLoading" : { "type" : "boolean" , "default" : "auto-managed from Promise" }
},
"viewSlots" : {
"icon" : { "type" : "ReactNode" , "default" : "variant-based delete icon" },
"children (Content)" : { "type" : "ReactNode" , "default" : "title + message" },
"children (Actions)" : { "type" : "ReactNode" , "default" : "cancel + confirm buttons" }
}
},
"events" : [],
"sdkListeners" : [],
"types" : {
"CometChatConfirmDialogVariant" : "'danger' | 'warning' | 'info'"
}
}
Where It Fits
CometChatConfirmDialog is a base modal component used whenever a destructive or important action needs explicit user confirmation. Wire it into feature components like CometChatConversations (delete conversation), CometChatGroupMembers (kick/ban member), or CometChatMessageList (image moderation) to gate critical actions behind a confirmation step.
import { useState } from "react" ;
import { CometChatConfirmDialog } from "@cometchat/chat-uikit-react" ;
import "@cometchat/chat-uikit-react/css-variables.css" ;
function App () {
const [ showConfirm , setShowConfirm ] = useState ( false );
const handleDelete = async () => {
await deleteConversation ( conversationId );
};
return (
< div >
< button onClick = { () => setShowConfirm ( true ) } > Delete Conversation </ button >
< CometChatConfirmDialog.Root
isOpen = { showConfirm }
onClose = { () => setShowConfirm ( false ) }
variant = "danger"
>
< CometChatConfirmDialog.Icon />
< CometChatConfirmDialog.Content
title = "Delete Conversation?"
message = "This action cannot be undone."
/>
< CometChatConfirmDialog.Actions
cancelText = "Cancel"
confirmText = "Delete"
onConfirm = { handleDelete }
/>
</ CometChatConfirmDialog.Root >
</ div >
);
}
Minimal Render
import { CometChatConfirmDialog } from "@cometchat/chat-uikit-react" ;
import "@cometchat/chat-uikit-react/css-variables.css" ;
function Demo () {
return (
< CometChatConfirmDialog.Root isOpen = { true } onClose = { () => {} } >
< CometChatConfirmDialog.Icon />
< CometChatConfirmDialog.Content />
< CometChatConfirmDialog.Actions />
</ CometChatConfirmDialog.Root >
);
}
Root CSS class: .cometchat-confirm-dialog
Actions and Events
Callback Props
onConfirm
Called when the confirm button is clicked. If it returns a Promise, the button automatically shows a loading state and catches errors.
< CometChatConfirmDialog.Actions
onConfirm = {async () => {
await api . deleteConversation ( id );
} }
/>
onCancel
Called when the cancel button is clicked. Falls back to onClose from context if not provided.
< CometChatConfirmDialog.Actions
onCancel = { () => {
console . log ( "User cancelled" );
setOpen ( false );
} }
/>
onClose
Called when the dialog requests to close (Escape key, outside click, or cancel button).
< CometChatConfirmDialog.Root
isOpen = { open }
onClose = { () => setOpen ( false ) }
>
{ /* ... */ }
</ CometChatConfirmDialog.Root >
Custom View Slots
Slot Signature Replaces icon (Icon)ReactNodeDefault variant-based icon children (Content)ReactNodeTitle + message text children (Actions)ReactNodeCancel + confirm buttons
Custom Icon
Replace the default delete icon with any React element.
< CometChatConfirmDialog.Icon
icon = {
< svg width = "36" height = "36" viewBox = "0 0 24 24" fill = "none" >
< path d = "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" fill = "#f5a623" />
</ svg >
}
/>
/* The icon wrapper can be styled via the BEM class */
.cometchat-confirm-dialog__icon {
background : #fff3e0 ;
}
Custom Content
Override the title/message with fully custom children.
< CometChatConfirmDialog.Content >
< div style = { { textAlign: "center" } } >
< h3 > Are you absolutely sure? </ h3 >
< p > This will permanently remove all messages. </ p >
< p >< strong > This cannot be undone. </ strong ></ p >
</ div >
</ CometChatConfirmDialog.Content >
.cometchat-confirm-dialog__content {
gap : 8 px ;
}
Custom Actions
Replace the default buttons with fully custom action elements.
< CometChatConfirmDialog.Actions >
< button onClick = { handleCancel } > Go Back </ button >
< button onClick = { handleConfirm } style = { { background: "red" , color: "white" } } >
Yes, Delete Everything
</ button >
</ CometChatConfirmDialog.Actions >
.cometchat-confirm-dialog__actions {
justify-content : flex-end ;
}
CSS Architecture
The component uses CSS custom properties (design tokens) defined in @cometchat/chat-uikit-react/css-variables.css. The cascade:
Global tokens set on the .cometchat root wrapper.
Component CSS (.cometchat-confirm-dialog) consumes these tokens via var().
Overrides target .cometchat-confirm-dialog descendant selectors.
Key Selectors
Target Selector Backdrop .cometchat-confirm-dialog__backdropDialog container .cometchat-confirm-dialogIcon wrapper .cometchat-confirm-dialog__iconContent area .cometchat-confirm-dialog__contentTitle .cometchat-confirm-dialog__content-titleMessage .cometchat-confirm-dialog__content-messageActions row .cometchat-confirm-dialog__actionsCancel button .cometchat-confirm-dialog__actions-cancelConfirm button .cometchat-confirm-dialog__actions-confirmError banner .cometchat-confirm-dialog__error
Example: Brand-themed dialog
.cometchat-confirm-dialog {
border-radius : 24 px ;
border-color : #e0e0e0 ;
}
.cometchat-confirm-dialog__icon {
background : #fce4ec ;
}
.cometchat-confirm-dialog__actions-confirm--danger button {
background : #d32f2f ;
}
Customization Matrix
What to change Where Property/API Example Override behavior Component props onConfirm, onCancel, onCloseonConfirm={handleDelete}Control open state Component props isOpen, onCloseisOpen={showDialog}Change variant Component props variantvariant="warning"Disable outside click Component props closeOnOutsideClickcloseOnOutsideClick={false}Replace icon Sub-component prop icon on Icon<Icon icon={<MyIcon />} />Replace content Sub-component children children on Content<Content><Custom /></Content>Replace buttons Sub-component children children on Actions<Actions><Custom /></Actions>Change visual styling Global CSS .cometchat-confirm-dialog selectorsSee CSS Selectors table
Props
All props are optional unless noted otherwise.
cancelText
Text for the cancel button.
Type stringDefault Localized "Cancel"
children (Root)
Sub-components to render inside the dialog. Required on Root.
Type ReactNodeDefault Icon + Content + Actions
className
Optional custom CSS class name applied to the component root.
Type stringDefault undefined
closeOnOutsideClick
Whether clicking outside the dialog closes it.
confirmText
Text for the confirm button.
Type stringDefault Localized "Confirm"
errorText
Error message displayed above the action buttons. Auto-set when onConfirm rejects.
Type stringDefault undefined
icon
Custom icon element for the Icon sub-component.
Type ReactNodeDefault Variant-based delete icon
isLoading
Whether the confirm button shows a loading state. Auto-managed when onConfirm returns a Promise.
Type booleanDefault Auto-managed
isOpen
Whether the dialog is open. When provided, the component is controlled.
Type booleanDefault undefined (uncontrolled)
message
Descriptive message text in the Content sub-component.
Type stringDefault Localized delete subtitle
onCancel
Callback when the cancel button is clicked. Falls back to onClose.
Type () => voidDefault Calls onClose
onClose
Callback when the dialog requests to close.
Type () => voidDefault undefined
onConfirm
Callback when the confirm button is clicked. Can return a Promise for async operations.
Type () => void | Promise<void>Default undefined
title
Title text in the Content sub-component.
Type stringDefault Localized delete title
variant
Visual variant affecting icon and confirm button color.
Type 'danger' | 'warning' | 'info'Default 'danger'
type CometChatConfirmDialogVariant = 'danger' | 'warning' | 'info' ;
CSS Selectors
Target Selector Backdrop overlay .cometchat-confirm-dialog__backdropDialog container .cometchat-confirm-dialogIcon wrapper .cometchat-confirm-dialog__iconIcon danger modifier .cometchat-confirm-dialog__icon--dangerIcon warning modifier .cometchat-confirm-dialog__icon--warningIcon info modifier .cometchat-confirm-dialog__icon--infoDefault icon element .cometchat-confirm-dialog__icon-defaultContent area .cometchat-confirm-dialog__contentTitle text .cometchat-confirm-dialog__content-titleMessage text .cometchat-confirm-dialog__content-messageActions row .cometchat-confirm-dialog__actionsCancel button wrapper .cometchat-confirm-dialog__actions-cancelConfirm button wrapper .cometchat-confirm-dialog__actions-confirmConfirm danger modifier .cometchat-confirm-dialog__actions-confirm--dangerConfirm warning modifier .cometchat-confirm-dialog__actions-confirm--warningConfirm info modifier .cometchat-confirm-dialog__actions-confirm--infoConfirm loading modifier .cometchat-confirm-dialog__actions-confirm--loadingError banner .cometchat-confirm-dialog__error