import { Chat, ThreadList } from "stream-chat-react";
<Chat client={client}>
<ThreadList />
</Chat>;This is beta documentation for Stream Chat React SDK v14. For the latest stable version, see the latest version (v13)
.
ThreadList
ThreadList renders the current user's threads and keeps them in sync with client.threads.state.
Best Practices
- Render
ThreadListinsideChatView.Threadswhen your app needs thread selection. - Keep custom thread rows lightweight because the list is virtualized with
react-virtuoso. - Use
ThreadListItemandThreadListItemUIinstead of rebuilding thread item state by hand. - Let the SDK manage thread activation and deactivation through
ChatView.ThreadAdapteroruseActiveThread. - Test the list on smaller screens where sidebar open/close behavior matters.
Basic Usage
ThreadList must be rendered under Chat, but it does not require Channel.
The default list includes:
ThreadListHeaderThreadListUnseenThreadsBanner- a virtualized list of
ThreadListItem ThreadListLoadingIndicatorandThreadListEmptyPlaceholder
Selection With ChatView
When you render ThreadList inside ChatView.Threads, the list can use ThreadsViewContext for selection. Pair it with ChatView.ThreadAdapter to render the selected thread:
import { Chat, ChatView, Thread, ThreadList } from "stream-chat-react";
const App = () => (
<Chat client={client}>
<ChatView>
<ChatView.Selector iconOnly={false} />
<ChatView.Threads>
<ThreadList />
<ChatView.ThreadAdapter>
<Thread />
</ChatView.ThreadAdapter>
</ChatView.Threads>
</ChatView>
</Chat>
);ChatView.ThreadAdapter now renders an empty-state placeholder once the thread manager is ready and no thread is selected, instead of staying blank.
If you want to keep the older blank panel behavior, provide EmptyStateIndicator={() => null} through WithComponents or manage ThreadProvider yourself with useThreadsViewContext().
Props
| Prop | Description | Type |
|---|---|---|
virtuosoProps | Props forwarded to the underlying Virtuoso instance. | VirtuosoProps<Thread, unknown> |