Channel list
A channel list shows a complete list of group channels that the current user is a member of by using the ChannelList
module. Once the client app is connected to the Sendbird server, you can display the channel list. All chat services built with Sendbird UIKit begin from the channel list.
Usage
To start using the ChannelList
module, implement the following code:
List of properties
The following table lists the properties of the ChannelList
module.
Proprety name | Type | Description |
---|---|---|
className | string | Specifies the CSS custom name of the class. (Default: |
isTypingIndicatorEnabled | boolean | Determines whether the typing indicator appears on the channel list view. (Default: |
isMessageReceiptStatusEnabled | boolean | Determines whether the message receipt status appears on the channel list view. The possible message receipt statuses are |
disableAutoSelect | boolean | Determines whether the first channel in the channel list view is automatically selected. (Default: |
onBeforeCreateChannel | function | Specifies the prop to execute custom operations before creating a channel. (Default: |
onThemeChange | function | Specifies the prop to receive callback when the theme has changed between |
onProfileEditSuccess | function | Specifies the prop to receive callback when a user profile has been successfully edited. (Default: |
onChannelSelect | function | Specifies the prop to execute custom operations when listing the group channels of the current user. (Default: |
sortChannelList | function | Specifies the function to sort channels in the UI. Don't add or remove channels from the |
queries.channelListQuery | instance | Specifies a GroupChannelListQuery |
renderUserProfile | ReactElement | Renders a customized user profile preview dialog when selecting the profile avatar. The following are given as arguments: |
renderHeader | ReactElement | Renders a customized header component to replace the default header. The following are given as arguments: |
renderPlaceHolderError | ReactElement | Renders a customized placeholder for an error status in the channel list. (Default: |
renderPlaceHolderLoading | ReactElement | Renders a customized placeholder for a loading status in the channel list. (Default: |
renderPlaceHolderEmptyList | ReactElement | Renders a customized placeholder for an empty list status when the channel list is empty. (Default: |
renderChannelPreview | ReactElement | Renders a customized channel preview component to replace the default |
allowProfileEdit | boolean | Determines whether to allow the user to edit their profile. (Default: |
Context
To store and handle data that are used to build a working channel list, Sendbird UIKit provides two context objects: ChannelListProvider
and useChannelListContext
hook. ChannelListProvider
is a provider that manages all the logic and data used in the channel list view. useChannelListContext
is a context hook that allows access to the provider's data.
ChannelListProvider
ChannelListProvider
contains input props and internal data that handle all the operations in the module. The provider stores data from Chat SDK in real-time and exports them to the UI components. The following code shows how to start using ChannelListProvider
.
List of properties
The following table lists the properties of ChannelListProvider
.
Property name | Type | Description |
---|---|---|
className | string | Specifies the CSS custom name of the class. (Default: |
onBeforeCreateChannel | function | Specifies the prop to execute custom operations before creating a channel. (Default: |
onThemeChange | function | Specifies the prop to receive callback when the theme has changed between |
onProfileEditSuccess | function | Specifies the prop to receive callback when a user profile has been successfully edited. (Default: |
onChannelSelect | function | Specifies the prop to execute custom operations when listing the group channels of the current user. (Default: |
sortChannelList | function | Specifies the function to sort channels in the UI. Don't add or remove channels from the |
queries.channelListQuery | instance | Specifies a GroupChannelListQuery |
allowProfileEdit | boolean | Determines whether to allow the user to edit their profile. (Default: |
renderUserProfile | ReactElement | Renders a customized user profile preview dialog when selecting the user avatar. The following are given as arguments: |
disableUserProfile | boolean | Determines whether to display the user profile preview dialog when selecting the user avatar. If set to |
useChannelListContext
The useChannelListContext
context hook exports the data in the provider to the UI components to create a functional view of the channel list. Every UI component of any layer or level can get access to the data using the context hooks as long as they're inside the provider.
The following code shows how to start using useChannelListContext
.
List of properties
The following table lists the properties of useChannelListContext
.
Property name | Type | Description |
---|---|---|
initialized | boolean | Determines whether the channel list is initialized. |
loading | boolean | Determines whether the channel list is loading. |
allChannels | array of objects | Specifies a list of channels that are loaded in the list. |
currentChannel | Specifies the current user's selected group channel. | |
channelListQuery | GroupChannelListQuery | Specifies the current user's GroupChannelListQuery |
channelSource | instance | Specifies the instance of GroupChannelListQuery |
UI components
The UI components in the ChannelList
module are the following: ChannelListUI
, ChannelListHeader
, and ChannelPreview
. They're the default set of UI components that compose the channel list view.
ChannelListUI
ChannelListUI
is the component that displays the basic screen of the module. It contains placeholders for error and loading statuses and renders the header and channel preview. The following code shows how to implement ChannelListUI
.
List of properties
The following table lists the properties of ChannelListUI
.
Property name | Type | Description |
---|---|---|
renderHeader | ReactElement | Renders a customized header component to replace the default header. The following are given as arguments: |
renderPlaceHolderError | ReactElement | Renders a customized placeholder for an error status in the channel list. (Default: |
renderPlaceHolderLoading | ReactElement | Renders a customized placeholder for a loading status in the channel list. (Default: |
renderPlaceHolderEmptyList | ReactElement | Renders a customized placeholder for an empty list status when the channel list is empty. (Default: |
renderChannelPreview | ReactElement | Renders a customized channel preview component to replace the default |
ChannelListHeader
ChannelListHeader
is the header component of the ChannelListUI
that displays the title and a button to create a new channel.
The following code shows how to implement ChannelListHeader
.
List of properties
Property name | Type | Description |
---|---|---|
renderHeader | ReactElement | Renders a customized header to replace the default header. The following are given as arguments: |
renderIconButton | ReactElement | Renders a customized icon button to create a new group channel. (Default: |
allowProfileEdit | boolean | Determines whether to allow the user to edit their profile. (Default: |
ChannelPreview
ChannelPreview
is a component that displays a single channel in the list item UI. You can customize this component using renderChannelPreview
.
The following code shows how to implement ChannelPreview
.
List of properties
Property name | Type | Description |
---|---|---|
channel | instance | Specifies the channel instance shown in the list item. (Default: |
onClick | function | Specifies the prop to select a channel item in the list. (Default: |
renderChannelAction | ReactElement | Renders a customized action on the channel list item when selected. (Default: |
isActive | boolean | Determines whether the channel displayed in the list item UI is currently active. (Default: |