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:
| ID | Description |
|---|---|
ChannelsMenuID.PIN | Pin to top |
ChannelsMenuID.UNPIN | Unpin |
ChannelsMenuID.MUTE | Mute notifications |
ChannelsMenuID.UNMUTE | Unmute |
ChannelsMenuID.REMOVE | Delete 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:
PINshows only whenchannelModel.isPinned === falseUNPINshows only whenchannelModel.isPinned === trueMUTEshows only when the channel is not mutedUNMUTEshows only when the channel is mutedREMOVEis 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);
});