Skip to main content

Channel List

The ChannelList component queries an array of channel objects from the Chat API

Basic Usage

tip

If your channelList list is empty, you can create a chat room in createChannel.

The ChannelList does not have any required props

Custom Component

ChannelList UI is determined by two of its props, List and Preview,if no props are injected, the default rendering ChannelListMessenger and Channel item Style.

listRef is a required attribute and must be bound to the Custom ChannelListMessenger root node. This is necessary for the ChannelList to implement paging.

  1. List renders loading failure, loading, and loading success views by error and loading properties.
  2. DefaultEmptyStateIndicator is used to show the empty state view.
  3. Paginator is a channelList subcomponent for pagination, Paginator component accepts elment, loadNextPage, and showLoading properties from ChannelList component;
  4. Preview is used to render style and click functionality of channel in the list.

Api

ChannelList

The properties of the ChannelList are described as follows:

PropertyDescriptionTypeDefaultrequired
Listas ChannelList‘s root component, used to display a component that the list load and failed to loadReact.ComponentTypeChannelListMessengerfalse
Previewset your custom ChannelItem componentReact.ComponentTypeChannelPreviewfalse
DefaultEmptyStateIndicatordisplays an empty list of componentsReact.ComponentTypeEmptyStateIndicatorfalse
Paginatorset your custom paging componentReact.ComponentTypePaginatorfalse

ChannelListMessenger

The properties of the ChannelListMessenger are described as follows:

PropertyDescriptionTypeDefaultrequired
errorset the error stateBoolean-false
loadingset the load stateBoolean-false
listRefbind ChannelListMessenger root nodeHTMLDivElement-true

Paginator

The properties of the Paginator are described as follows:

PropertyDescriptionTypeDefaultrequired
elementChannelListMessenger root nodeHTMLDivElement-false
showLoadingset the load stateBooleanfalsefalse
loadNextPageLoad moreFunction-true

ChannelPreview

The properties of the ChannelPreview are described as follows:

PropertyDescriptionTypeDefaultrequired
activeWhether it is the current ChannelBoolean-true
avatarUrlresource address of the image avatarString-true
channelChat room informationChannelItemType-true
displayTitlethe user name or IDString-true
lastMessagethe latest newsString-true
updatedAtthe Latest timeString-true
setActiveChannelthe callback when clickedFunction-true