Channel List for PubNub Chat Components for React

USED BY THE OLD IA, PLEASE DISREGARD

Renders an interactive list of channels.

It can represent all channels of the application, only channels joined by the current user, all channels available to be joined, or whatever else is passed into it. A common pattern in chat applications is to render two instances of the component - one visible all the time to show joined channels, and another one hidden inside a modal with channels available to join. Make sure to handle the onChannelSwitched event to switch the current channel passed to the Chat provider.

Component​

This section shows the preview of a sample Channel List component and its source code.

Channel thumb

Company Culture

Company culture space

Channel thumb

Daily Standup

Async virtual standup

Channel thumb

Exec AMA

Ask the CEO anything

Channel thumb

India Office

भारत के कार्यालय में आपका स्वागत है🇮🇳!

Channel thumb

Introductions

This channel is for company wide chatter

Channel thumb

London Office

London Office 🇬🇧

Channel thumb

Movies

Everything about movies

Channel thumb

Off Topic

Non-work banter and water cooler conversation

Channel thumb

Poland Office

Zapytaj Nas O Cokolwiek 🇵🇱

Channel thumb

Running

soc-running space

Parameters​

You can configure the component using these parameters:

channels#
Type: ChannelEntity[] | string[]
Option to pass a list of channels, including metadata, to render on the list.
Default value
n/a
sort?#
Type: (a: ChannelEntity, b: ChannelEntity) => -1 | 0 | 1
Channels are sorted alphabetically by default, you can override that by providing a sorter function.
Default value
n/a
extraActionsRenderer?#
Type: (channel: ChannelEntity) => JSX.Element
Option to provide an extra actions renderer to add custom action buttons to each channel.
Default value
n/a
channelRenderer?#
Type: (channel: ChannelEntity) => JSX.Element
Option to provide a custom channel renderer to override default themes and CSS variables.
Default value
n/a
onChannelSwitched?#
Type: (channel: ChannelEntity) => unknown
Callback run when a user clicked one of the channels. Can be used to switch the current channel.
Default value
n/a

Was this page useful?

Last updated on