Skip to main content
Components provide context menus (e.g., long-press on a conversation or message). You can replace all options or append custom ones.

setOptions vs addOptions

MethodBehavior
setOptionsReplaces all default options with your custom list
addOptionsAppends your custom options to the existing defaults
Use addOptions to keep defaults (like “Delete”) and add your own. Use setOptions for full control.

Adding Custom Options

import com.cometchat.uikit.kotlin.presentation.shared.popupmenu.CometChatPopupMenu

conversations.addOptions { context, conversation ->
    listOf(
        CometChatPopupMenu.MenuItem(
            id = "pin",
            name = "Pin Conversation",
            startIcon = ContextCompat.getDrawable(context, R.drawable.ic_pin),
            onClick = { pinConversation(conversation) }
        )
    )
}

Replacing All Options

conversations.setOptions { context, conversation ->
    listOf(
        CometChatPopupMenu.MenuItem(
            id = "archive",
            name = "Archive",
            startIcon = ContextCompat.getDrawable(context, R.drawable.ic_archive),
            onClick = { archiveConversation(conversation) }
        ),
        CometChatPopupMenu.MenuItem(
            id = "mute",
            name = "Mute",
            startIcon = ContextCompat.getDrawable(context, R.drawable.ic_mute),
            onClick = { muteConversation(conversation) }
        )
    )
}

CometChatPopupMenu.MenuItem:
PropertyTypeDescription
idStringUnique identifier
nameStringDisplay text
startIconDrawable?Icon at the start
endIconDrawable?Icon at the end
startIconTint@ColorInt IntStart icon tint
textColor@ColorInt IntText color
textAppearance@StyleRes IntText appearance
onClick(() -> Unit)?Click callback
Both modules provide convenience factory methods:
// Simple menu item (no icons)
MenuItem.simple(id = "pin", name = "Pin") { /* onClick */ }

// Menu item with icons (Compose)
MenuItem.withIcons(id = "pin", name = "Pin", startIcon = painterResource(R.drawable.ic_pin)) { /* onClick */ }

Components with Menu Options

ComponentData passed to callback
CometChatConversations(Context, Conversation)
CometChatUsers(Context, User)
CometChatGroups(Context, Group)
CometChatGroupMembers(Context, GroupMember)
CometChatCallLogs(Context, CallLog)