useChannelDetailsMembersPreview

A hook that builds a capped preview of a channel's members for the members section of ChannelDetails. It returns the first max members to display, the total member count, and whether more members exist beyond the preview.

Best Practices

  • Use it to render a member preview row with a "view all" entry point instead of slicing the member list yourself.
  • Pass an already-initialized channel so member state is available.
  • Use hasMore to decide whether to show a "view all members" affordance.
  • Keep max stable across renders to avoid unnecessary recomputation.
  • Prefer total over visible.length when displaying the member count.

Parameters

ParameterDescriptionType
channelThe channel whose members should be previewed.Channel
maxMaximum number of members to include in visible. Defaults to 5.number

Return type

Returns a ChannelDetailsMembersPreview object.

hasMore

Whether there are more members than the max shown in visible.

Type
boolean

total

The total number of members in the channel.

Type
number

visible

The capped list of members to display (up to max).

Type
ChannelMemberResponse[]