Skip to main content

Channel list menu

When users open the context menu on a channel list row (right-click or long-press depending on platform), built-in actions may appear. IDs are defined by ChannelsMenuID:

IDDescription
ChannelsMenuID.PINPin to top
ChannelsMenuID.UNPINUnpin
ChannelsMenuID.MUTEMute notifications
ChannelsMenuID.UNMUTEUnmute
ChannelsMenuID.REMOVEDelete the channel

Labels resolve through i18n keys that match the id strings; override copy via Localization.

Customize the menu

cloneChannelsMenu returns a shallow copy of the array; mutate and pass to setChannelsMenu.

The built-in items follow these visibility rules:

  • PIN shows only when channelModel.isPinned === false
  • UNPIN shows only when channelModel.isPinned === true
  • MUTE shows only when the channel is not muted
  • UNMUTE shows only when the channel is muted
  • REMOVE is always present unless you remove it from the array
TypeScript
import type { ChannelsMenuItem } from '@nexconn/chatui';

const menu: ChannelsMenuItem[] = app.cloneChannelsMenu();
menu.push({
id: 'channel.menu.item.archive',
icon: 'https://example.com/archive.svg',
filter: (model) => !model.isPinned,
});
app.setChannelsMenu(menu);

See ChannelsMenuItem; optional filter can hide rows using ChatUIChannelModel.

Custom item clicks emit ChatUIEvents CHANNELS_MENU_ITEM_CLICK with ChannelsMenuItemClick.

TypeScript
import { ChatUIEvents } from '@nexconn/chatui';

app.addEventListener(ChatUIEvents.CHANNELS_MENU_ITEM_CLICK, (evt) => {
console.log(evt.data.id, evt.data.channelModel);
});