ThreadListPrimitive
Displays a list of conversation threads.
Anatomy
import { ThreadListPrimitive } from "@assistant-ui/react";
const ThreadList = () => (
<ThreadListPrimitive.Root>
<ThreadListPrimitive.New />
<ThreadListPrimitive.Items
components={{
ThreadListItem: MyThreadListItem
}}
/>
</ThreadListPrimitive.Root>
);
API Reference
Root
Contains all parts of the thread list.
This primitive renders a <div>
element unless asChild
is set.
ThreadListPrimitiveRootProps
asChild:
Change the default rendered element for the one passed as a child, merging their props and behavior.
Read the Composition guide for more details.
New
A button to create a new thread.
This primitive renders a <button>
element unless asChild
is set.
ThreadListPrimitiveNewProps
asChild:
Change the default rendered element for the one passed as a child, merging their props and behavior.
Read the Composition guide for more details.
Items
Renders all items in the thread list.
ThreadListPrimitive.Items.Props
archived:
Whether to show archived threads instead of active threads.
components:
The components to render for each thread list item.
ThreadListItemComponents
ThreadListItem:
The component to render for each thread in the list.
ItemByIndex
Renders a single thread list item at the specified index.
<ThreadListPrimitive.ItemByIndex
index={0}
components={{
ThreadListItem: MyThreadListItem
}}
/>
ThreadListPrimitive.ItemByIndex.Props
index:
The index of the thread list item to render.
archived:
Whether to render from archived threads instead of active threads.
components:
The components to render for the thread list item.