@assistant-ui/mcp-docs-server 0.1.24 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/organized/code-examples/waterfall.md +8 -6
- package/.docs/organized/code-examples/with-a2a.md +676 -0
- package/.docs/organized/code-examples/with-ag-ui.md +10 -11
- package/.docs/organized/code-examples/with-ai-sdk-v6.md +31 -19
- package/.docs/organized/code-examples/with-artifacts.md +8 -8
- package/.docs/organized/code-examples/with-assistant-transport.md +6 -6
- package/.docs/organized/code-examples/with-chain-of-thought.md +37 -29
- package/.docs/organized/code-examples/with-cloud-standalone.md +14 -11
- package/.docs/organized/code-examples/with-cloud.md +8 -8
- package/.docs/organized/code-examples/with-custom-thread-list.md +10 -10
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +11 -11
- package/.docs/organized/code-examples/with-expo.md +571 -520
- package/.docs/organized/code-examples/with-external-store.md +6 -6
- package/.docs/organized/code-examples/with-ffmpeg.md +8 -8
- package/.docs/organized/code-examples/with-google-adk.md +353 -0
- package/.docs/organized/code-examples/with-heat-graph.md +304 -0
- package/.docs/organized/code-examples/with-interactables.md +778 -0
- package/.docs/organized/code-examples/with-langgraph.md +28 -26
- package/.docs/organized/code-examples/with-parent-id-grouping.md +7 -7
- package/.docs/organized/code-examples/with-react-hook-form.md +9 -9
- package/.docs/organized/code-examples/with-react-ink.md +265 -0
- package/.docs/organized/code-examples/with-react-router.md +12 -12
- package/.docs/organized/code-examples/with-store.md +33 -22
- package/.docs/organized/code-examples/with-tanstack.md +10 -10
- package/.docs/organized/code-examples/with-tap-runtime.md +12 -10
- package/.docs/raw/blog/2025-01-31-changelog/index.mdx +1 -1
- package/.docs/raw/blog/2026-03-launch-week/index.mdx +258 -0
- package/.docs/raw/docs/(docs)/architecture.mdx +1 -1
- package/.docs/raw/docs/(docs)/cli.mdx +74 -9
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +8 -3
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +5 -1
- package/.docs/raw/docs/(docs)/copilots/{make-assistant-readable.mdx → make-assistant-visible.mdx} +14 -5
- package/.docs/raw/docs/(docs)/copilots/model-context.mdx +11 -11
- package/.docs/raw/docs/(docs)/copilots/motivation.mdx +2 -2
- package/.docs/raw/docs/(docs)/devtools.mdx +3 -2
- package/.docs/raw/docs/(docs)/guides/attachments.mdx +74 -15
- package/.docs/raw/docs/(docs)/guides/branching.mdx +11 -6
- package/.docs/raw/docs/(docs)/guides/chain-of-thought.mdx +18 -16
- package/.docs/raw/docs/(docs)/guides/context-api.mdx +81 -43
- package/.docs/raw/docs/(docs)/guides/dictation.mdx +5 -5
- package/.docs/raw/docs/(docs)/guides/editing.mdx +16 -7
- package/.docs/raw/docs/(docs)/guides/interactables.mdx +292 -0
- package/.docs/raw/docs/(docs)/guides/latex.mdx +3 -0
- package/.docs/raw/docs/(docs)/guides/message-timing.mdx +5 -4
- package/.docs/raw/docs/(docs)/guides/multi-agent.mdx +174 -0
- package/.docs/raw/docs/(docs)/guides/quoting.mdx +55 -206
- package/.docs/raw/docs/(docs)/guides/speech.mdx +1 -4
- package/.docs/raw/docs/(docs)/guides/suggestions.mdx +9 -15
- package/.docs/raw/docs/(docs)/guides/tool-ui.mdx +17 -7
- package/.docs/raw/docs/(docs)/guides/tools.mdx +24 -9
- package/.docs/raw/docs/(docs)/index.mdx +3 -3
- package/.docs/raw/docs/(docs)/installation.mdx +69 -46
- package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx +20 -6
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +24 -4
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-hook-form.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/integrations/vercel-ai-sdk.mdx +20 -19
- package/.docs/raw/docs/(reference)/api-reference/overview.mdx +28 -53
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +4 -4
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +7 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +20 -14
- package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +226 -44
- package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +52 -40
- package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +343 -23
- package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +4 -6
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +4 -2
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +3 -5
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +169 -22
- package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +14 -4
- package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +15 -26
- package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +39 -21
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +33 -9
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +48 -21
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +36 -7
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +30 -10
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +12 -10
- package/.docs/raw/docs/(reference)/migrations/deprecation-policy.mdx +1 -1
- package/.docs/raw/docs/(reference)/migrations/react-langgraph-v0-7.mdx +9 -4
- package/.docs/raw/docs/(reference)/migrations/v0-11.mdx +7 -5
- package/.docs/raw/docs/(reference)/migrations/v0-12.mdx +9 -7
- package/.docs/raw/docs/(reference)/migrations/v0-14.mdx +159 -0
- package/.docs/raw/docs/(reference)/react-compatibility.mdx +5 -134
- package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +90 -6
- package/.docs/raw/docs/cloud/ai-sdk.mdx +95 -5
- package/.docs/raw/docs/cloud/langgraph.mdx +13 -3
- package/.docs/raw/docs/ink/adapters.mdx +41 -0
- package/.docs/raw/docs/ink/custom-backend.mdx +203 -0
- package/.docs/raw/docs/ink/hooks.mdx +448 -0
- package/.docs/raw/docs/ink/index.mdx +239 -0
- package/.docs/raw/docs/ink/migration.mdx +140 -0
- package/.docs/raw/docs/ink/primitives.mdx +840 -0
- package/.docs/raw/docs/primitives/action-bar.mdx +351 -0
- package/.docs/raw/docs/primitives/assistant-modal.mdx +215 -0
- package/.docs/raw/docs/primitives/attachment.mdx +216 -0
- package/.docs/raw/docs/primitives/branch-picker.mdx +221 -0
- package/.docs/raw/docs/primitives/chain-of-thought.mdx +311 -0
- package/.docs/raw/docs/primitives/composer.mdx +526 -0
- package/.docs/raw/docs/primitives/error.mdx +141 -0
- package/.docs/raw/docs/primitives/index.mdx +98 -0
- package/.docs/raw/docs/primitives/message.mdx +524 -0
- package/.docs/raw/docs/primitives/selection-toolbar.mdx +165 -0
- package/.docs/raw/docs/primitives/suggestion.mdx +242 -0
- package/.docs/raw/docs/primitives/thread-list.mdx +404 -0
- package/.docs/raw/docs/primitives/thread.mdx +482 -0
- package/.docs/raw/docs/react-native/adapters.mdx +63 -87
- package/.docs/raw/docs/react-native/custom-backend.mdx +11 -14
- package/.docs/raw/docs/react-native/hooks.mdx +214 -232
- package/.docs/raw/docs/react-native/index.mdx +118 -159
- package/.docs/raw/docs/react-native/migration.mdx +144 -0
- package/.docs/raw/docs/react-native/primitives.mdx +431 -302
- package/.docs/raw/docs/runtimes/a2a/index.mdx +294 -0
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +9 -9
- package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +14 -3
- package/.docs/raw/docs/runtimes/assistant-transport.mdx +59 -25
- package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +13 -6
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +138 -38
- package/.docs/raw/docs/runtimes/custom/local.mdx +184 -42
- package/.docs/raw/docs/runtimes/data-stream.mdx +92 -19
- package/.docs/raw/docs/runtimes/google-adk/index.mdx +624 -0
- package/.docs/raw/docs/runtimes/helicone.mdx +6 -6
- package/.docs/raw/docs/runtimes/langgraph/index.mdx +38 -27
- package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +1 -1
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +15 -20
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +7 -11
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +8 -11
- package/.docs/raw/docs/runtimes/langserve.mdx +6 -7
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +18 -3
- package/.docs/raw/docs/ui/file.mdx +5 -4
- package/.docs/raw/docs/ui/image.mdx +5 -4
- package/.docs/raw/docs/ui/markdown.mdx +3 -1
- package/.docs/raw/docs/ui/mention.mdx +168 -0
- package/.docs/raw/docs/ui/model-selector.mdx +8 -8
- package/.docs/raw/docs/ui/part-grouping.mdx +7 -10
- package/.docs/raw/docs/ui/quote.mdx +210 -0
- package/.docs/raw/docs/ui/reasoning.mdx +12 -11
- package/.docs/raw/docs/ui/sources.mdx +88 -17
- package/.docs/raw/docs/ui/streamdown.mdx +16 -7
- package/.docs/raw/docs/ui/thread-list.mdx +11 -13
- package/.docs/raw/docs/ui/thread.mdx +28 -33
- package/.docs/raw/docs/ui/tool-fallback.mdx +5 -6
- package/.docs/raw/docs/ui/tool-group.mdx +9 -8
- package/.docs/raw/docs/utilities/heat-graph.mdx +236 -0
- package/.docs/raw/docs/utilities/tw-shimmer.mdx +211 -0
- package/package.json +5 -5
- package/.docs/raw/docs/(reference)/legacy/styled/assistant-modal.mdx +0 -77
- package/.docs/raw/docs/(reference)/legacy/styled/decomposition.mdx +0 -635
- package/.docs/raw/docs/(reference)/legacy/styled/markdown.mdx +0 -77
- package/.docs/raw/docs/(reference)/legacy/styled/scrollbar.mdx +0 -72
- package/.docs/raw/docs/(reference)/legacy/styled/thread-width.mdx +0 -22
- package/.docs/raw/docs/(reference)/legacy/styled/thread.mdx +0 -77
- /package/.docs/raw/docs/cloud/{overview.mdx → index.mdx} +0 -0
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ThreadList
|
|
3
|
+
description: Multi-thread management for listing, creating, switching, archiving, and deleting conversations.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { ThreadListPrimitiveSample } from "@/components/docs/samples/thread-list-primitive";
|
|
7
|
+
import { ThreadListPrimitive as ThreadListPrimitiveDocs, ThreadListItemPrimitive as ThreadListItemPrimitiveDocs, ThreadListItemMorePrimitive as ThreadListItemMorePrimitiveDocs } from "@/generated/primitiveDocs";
|
|
8
|
+
|
|
9
|
+
The ThreadList primitive manages multiple conversations by listing threads, creating new ones, switching between them, and archiving or deleting old ones. It's composed from three primitive namespaces: `ThreadListPrimitive`, `ThreadListItemPrimitive`, and `ThreadListItemMorePrimitive`.
|
|
10
|
+
|
|
11
|
+
<Tabs items={["Preview", "Code"]}>
|
|
12
|
+
<Tab>
|
|
13
|
+
<ThreadListPrimitiveSample />
|
|
14
|
+
</Tab>
|
|
15
|
+
<Tab>
|
|
16
|
+
```tsx
|
|
17
|
+
import {
|
|
18
|
+
ThreadListPrimitive,
|
|
19
|
+
ThreadListItemPrimitive,
|
|
20
|
+
ThreadListItemMorePrimitive,
|
|
21
|
+
} from "@assistant-ui/react";
|
|
22
|
+
import { ArchiveIcon, MoreHorizontalIcon, PlusIcon, TrashIcon } from "lucide-react";
|
|
23
|
+
|
|
24
|
+
function MyThreadList() {
|
|
25
|
+
return (
|
|
26
|
+
<ThreadListPrimitive.Root className="flex flex-col gap-1">
|
|
27
|
+
<ThreadListPrimitive.New className="flex h-9 items-center gap-2 rounded-lg border px-3 text-sm hover:bg-muted">
|
|
28
|
+
<PlusIcon className="size-4" />
|
|
29
|
+
New Thread
|
|
30
|
+
</ThreadListPrimitive.New>
|
|
31
|
+
<ThreadListPrimitive.Items>
|
|
32
|
+
{() => <ThreadListItem />}
|
|
33
|
+
</ThreadListPrimitive.Items>
|
|
34
|
+
</ThreadListPrimitive.Root>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function ThreadListItem() {
|
|
39
|
+
return (
|
|
40
|
+
<ThreadListItemPrimitive.Root className="group flex h-9 items-center rounded-lg hover:bg-muted data-active:bg-muted">
|
|
41
|
+
<ThreadListItemPrimitive.Trigger className="flex-1 truncate px-3 text-sm">
|
|
42
|
+
<ThreadListItemPrimitive.Title fallback="New Chat" />
|
|
43
|
+
</ThreadListItemPrimitive.Trigger>
|
|
44
|
+
<ThreadListItemMorePrimitive.Root>
|
|
45
|
+
<ThreadListItemMorePrimitive.Trigger className="mr-2 size-7 rounded-md opacity-0 group-hover:opacity-100">
|
|
46
|
+
<MoreHorizontalIcon className="size-4" />
|
|
47
|
+
</ThreadListItemMorePrimitive.Trigger>
|
|
48
|
+
<ThreadListItemMorePrimitive.Content className="rounded-md border bg-popover p-1 shadow-md">
|
|
49
|
+
<ThreadListItemPrimitive.Archive asChild>
|
|
50
|
+
<ThreadListItemMorePrimitive.Item className="flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent">
|
|
51
|
+
<ArchiveIcon className="size-4" /> Archive
|
|
52
|
+
</ThreadListItemMorePrimitive.Item>
|
|
53
|
+
</ThreadListItemPrimitive.Archive>
|
|
54
|
+
<ThreadListItemPrimitive.Delete asChild>
|
|
55
|
+
<ThreadListItemMorePrimitive.Item className="flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-destructive hover:bg-destructive/10">
|
|
56
|
+
<TrashIcon className="size-4" /> Delete
|
|
57
|
+
</ThreadListItemMorePrimitive.Item>
|
|
58
|
+
</ThreadListItemPrimitive.Delete>
|
|
59
|
+
</ThreadListItemMorePrimitive.Content>
|
|
60
|
+
</ThreadListItemMorePrimitive.Root>
|
|
61
|
+
</ThreadListItemPrimitive.Root>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
</Tab>
|
|
66
|
+
</Tabs>
|
|
67
|
+
|
|
68
|
+
## Quick Start
|
|
69
|
+
|
|
70
|
+
Minimal example:
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import {
|
|
74
|
+
ThreadListPrimitive,
|
|
75
|
+
ThreadListItemPrimitive,
|
|
76
|
+
} from "@assistant-ui/react";
|
|
77
|
+
|
|
78
|
+
<ThreadListPrimitive.Root>
|
|
79
|
+
<ThreadListPrimitive.New>New Thread</ThreadListPrimitive.New>
|
|
80
|
+
<ThreadListPrimitive.Items>
|
|
81
|
+
{() => (
|
|
82
|
+
<ThreadListItemPrimitive.Root>
|
|
83
|
+
<ThreadListItemPrimitive.Trigger>
|
|
84
|
+
<ThreadListItemPrimitive.Title fallback="New Chat" />
|
|
85
|
+
</ThreadListItemPrimitive.Trigger>
|
|
86
|
+
</ThreadListItemPrimitive.Root>
|
|
87
|
+
)}
|
|
88
|
+
</ThreadListPrimitive.Items>
|
|
89
|
+
</ThreadListPrimitive.Root>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`Root` renders a `<div>`, `New` renders a `<button>` that creates a new thread, and `Items` iterates over the thread list. Each item is composed from `ThreadListItemPrimitive` parts.
|
|
93
|
+
|
|
94
|
+
<Callout type="info">
|
|
95
|
+
Runtime setup: primitives require runtime context. Wrap your UI in `AssistantRuntimeProvider` with a runtime (for example `useLocalRuntime(...)`). See [Pick a Runtime](/docs/runtimes/pick-a-runtime).
|
|
96
|
+
</Callout>
|
|
97
|
+
|
|
98
|
+
## Core Concepts
|
|
99
|
+
|
|
100
|
+
### Three Namespaces
|
|
101
|
+
|
|
102
|
+
ThreadList is split across three namespaces to keep each level of abstraction composable:
|
|
103
|
+
|
|
104
|
+
- **`ThreadListPrimitive`**: The outer container. `Root` wraps the list, `New` creates threads, and `Items` iterates over them.
|
|
105
|
+
- **`ThreadListItemPrimitive`**: An individual thread row. `Root` provides context, `Trigger` switches to the thread, `Title` shows the thread name, and action buttons (Archive, Unarchive, Delete) manage the thread lifecycle.
|
|
106
|
+
- **`ThreadListItemMorePrimitive`**: An overflow dropdown menu (built on Radix DropdownMenu) for thread actions. Compose action buttons with menu items using `asChild`.
|
|
107
|
+
|
|
108
|
+
### Active State
|
|
109
|
+
|
|
110
|
+
Both `ThreadListPrimitive.New` and `ThreadListItemPrimitive.Root` get a `data-active` attribute when they represent the current thread. Use this for styling:
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
<ThreadListItemPrimitive.Root className="hover:bg-muted data-active:bg-muted">
|
|
114
|
+
{/* ... */}
|
|
115
|
+
</ThreadListItemPrimitive.Root>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The `New` button gets `data-active` when the user is on a fresh, unsaved thread.
|
|
119
|
+
|
|
120
|
+
### Items Iterator
|
|
121
|
+
|
|
122
|
+
`ThreadListPrimitive.Items` now prefers a children render function, similar to `ThreadPrimitive.Messages`:
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
<ThreadListPrimitive.Items>
|
|
126
|
+
{({ threadListItem }) => (
|
|
127
|
+
<MyThreadItem threadId={threadListItem.id} />
|
|
128
|
+
)}
|
|
129
|
+
</ThreadListPrimitive.Items>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
`components` is deprecated. Use the `children` render function instead.
|
|
133
|
+
|
|
134
|
+
### Archived Threads
|
|
135
|
+
|
|
136
|
+
Pass `archived` to `Items` to render archived threads separately:
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
<ThreadListPrimitive.Root>
|
|
140
|
+
<ThreadListPrimitive.New>New Thread</ThreadListPrimitive.New>
|
|
141
|
+
<ThreadListPrimitive.Items>
|
|
142
|
+
{() => <ThreadListItem />}
|
|
143
|
+
</ThreadListPrimitive.Items>
|
|
144
|
+
|
|
145
|
+
<h3>Archived</h3>
|
|
146
|
+
<ThreadListPrimitive.Items archived>
|
|
147
|
+
{() => <ArchivedThreadItem />}
|
|
148
|
+
</ThreadListPrimitive.Items>
|
|
149
|
+
</ThreadListPrimitive.Root>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Thread Actions
|
|
153
|
+
|
|
154
|
+
`Archive`, `Unarchive`, and `Delete` buttons disable automatically when the runtime capability is unavailable.
|
|
155
|
+
|
|
156
|
+
### Composing Actions with Menu Items
|
|
157
|
+
|
|
158
|
+
The canonical pattern composes `ThreadListItemPrimitive.Archive asChild` with `ThreadListItemMorePrimitive.Item` to get both the action behavior AND the menu item styling:
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
<ThreadListItemPrimitive.Archive asChild>
|
|
162
|
+
<ThreadListItemMorePrimitive.Item>
|
|
163
|
+
<ArchiveIcon className="size-4" /> Archive
|
|
164
|
+
</ThreadListItemMorePrimitive.Item>
|
|
165
|
+
</ThreadListItemPrimitive.Archive>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
`Archive` provides the click handler and disabled logic. `Item` provides the menu item behavior and styling. `asChild` merges them into a single element.
|
|
169
|
+
|
|
170
|
+
## Parts
|
|
171
|
+
|
|
172
|
+
### ThreadListPrimitive
|
|
173
|
+
|
|
174
|
+
#### Root
|
|
175
|
+
|
|
176
|
+
Container for the full thread list. Renders a `<div>` element unless `asChild` is set.
|
|
177
|
+
|
|
178
|
+
```tsx
|
|
179
|
+
<ThreadListPrimitive.Root className="flex flex-col gap-1">
|
|
180
|
+
<ThreadListPrimitive.Items>
|
|
181
|
+
{() => <MyThreadItem />}
|
|
182
|
+
</ThreadListPrimitive.Items>
|
|
183
|
+
</ThreadListPrimitive.Root>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
#### New
|
|
187
|
+
|
|
188
|
+
Button that creates a new thread. Renders a `<button>` element unless `asChild` is set.
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
<ThreadListPrimitive.New className="rounded-lg border px-3 py-2 text-sm">
|
|
192
|
+
New Thread
|
|
193
|
+
</ThreadListPrimitive.New>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
#### Items
|
|
197
|
+
|
|
198
|
+
Renders a component per thread.
|
|
199
|
+
|
|
200
|
+
```tsx
|
|
201
|
+
<ThreadListPrimitive.Items>
|
|
202
|
+
{() => <MyThreadItem />}
|
|
203
|
+
</ThreadListPrimitive.Items>
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
<PrimitivesTypeTable type="ThreadListPrimitiveItemsProps" parameters={ThreadListPrimitiveDocs.Items.props} />
|
|
207
|
+
|
|
208
|
+
#### ItemByIndex
|
|
209
|
+
|
|
210
|
+
Renders a single thread at a specific index.
|
|
211
|
+
|
|
212
|
+
```tsx
|
|
213
|
+
<ThreadListPrimitive.ItemByIndex
|
|
214
|
+
index={0}
|
|
215
|
+
components={{ ThreadListItem: MyThreadItem }}
|
|
216
|
+
/>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
<PrimitivesTypeTable type="ThreadListPrimitiveItemByIndexProps" parameters={ThreadListPrimitiveDocs.ItemByIndex.props} />
|
|
220
|
+
|
|
221
|
+
### ThreadListItemPrimitive
|
|
222
|
+
|
|
223
|
+
#### Root
|
|
224
|
+
|
|
225
|
+
Container for one thread list item. Renders a `<div>` element unless `asChild` is set.
|
|
226
|
+
|
|
227
|
+
```tsx
|
|
228
|
+
<ThreadListItemPrimitive.Root className="flex items-center gap-2 rounded-lg px-2 py-1.5">
|
|
229
|
+
<ThreadListItemPrimitive.Trigger className="flex-1 text-left">
|
|
230
|
+
<ThreadListItemPrimitive.Title fallback="New Chat" />
|
|
231
|
+
</ThreadListItemPrimitive.Trigger>
|
|
232
|
+
</ThreadListItemPrimitive.Root>
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
#### Trigger
|
|
236
|
+
|
|
237
|
+
Interactive button that selects the thread. Renders a `<button>` element unless `asChild` is set.
|
|
238
|
+
|
|
239
|
+
```tsx
|
|
240
|
+
<ThreadListItemPrimitive.Trigger className="flex-1 text-left">
|
|
241
|
+
<ThreadListItemPrimitive.Title fallback="New Chat" />
|
|
242
|
+
</ThreadListItemPrimitive.Trigger>
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
#### Title
|
|
246
|
+
|
|
247
|
+
Displays the thread title with a `fallback` prop. Renders a React fragment (no wrapper element). Use a `<span>` wrapper if you need to style it.
|
|
248
|
+
|
|
249
|
+
```tsx
|
|
250
|
+
<ThreadListItemPrimitive.Title fallback="New Chat" />
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
<PrimitivesTypeTable type="ThreadListItemPrimitiveTitleProps" parameters={ThreadListItemPrimitiveDocs.Title.props} />
|
|
254
|
+
|
|
255
|
+
#### Archive
|
|
256
|
+
|
|
257
|
+
Button that archives the current thread item. Renders a `<button>` element unless `asChild` is set.
|
|
258
|
+
|
|
259
|
+
```tsx
|
|
260
|
+
<ThreadListItemPrimitive.Archive>Archive</ThreadListItemPrimitive.Archive>
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
#### Unarchive
|
|
264
|
+
|
|
265
|
+
Button that restores the current thread item from the archive. Renders a `<button>` element unless `asChild` is set.
|
|
266
|
+
|
|
267
|
+
```tsx
|
|
268
|
+
<ThreadListItemPrimitive.Unarchive>Unarchive</ThreadListItemPrimitive.Unarchive>
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
#### Delete
|
|
272
|
+
|
|
273
|
+
Button that deletes the current thread item. Renders a `<button>` element unless `asChild` is set.
|
|
274
|
+
|
|
275
|
+
```tsx
|
|
276
|
+
<ThreadListItemPrimitive.Delete>Delete</ThreadListItemPrimitive.Delete>
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### ThreadListItemMorePrimitive
|
|
280
|
+
|
|
281
|
+
#### Root
|
|
282
|
+
|
|
283
|
+
Root container for the overflow menu primitives.
|
|
284
|
+
|
|
285
|
+
```tsx
|
|
286
|
+
<ThreadListItemMorePrimitive.Root>
|
|
287
|
+
<ThreadListItemMorePrimitive.Trigger>More</ThreadListItemMorePrimitive.Trigger>
|
|
288
|
+
</ThreadListItemMorePrimitive.Root>
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
#### Trigger
|
|
292
|
+
|
|
293
|
+
Button that opens the overflow menu. Renders a `<button>` element unless `asChild` is set.
|
|
294
|
+
|
|
295
|
+
```tsx
|
|
296
|
+
<ThreadListItemMorePrimitive.Trigger className="rounded-md p-1 hover:bg-muted">
|
|
297
|
+
More
|
|
298
|
+
</ThreadListItemMorePrimitive.Trigger>
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
#### Content
|
|
302
|
+
|
|
303
|
+
The dropdown panel. Renders a `<div>` via a portal (positioned relative to the trigger).
|
|
304
|
+
|
|
305
|
+
```tsx
|
|
306
|
+
<ThreadListItemMorePrimitive.Content className="rounded-md border bg-popover p-1 shadow-md">
|
|
307
|
+
<ThreadListItemPrimitive.Archive asChild>
|
|
308
|
+
<ThreadListItemMorePrimitive.Item>Archive</ThreadListItemMorePrimitive.Item>
|
|
309
|
+
</ThreadListItemPrimitive.Archive>
|
|
310
|
+
</ThreadListItemMorePrimitive.Content>
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
<PrimitivesTypeTable type="ThreadListItemMorePrimitiveContentProps" parameters={ThreadListItemMorePrimitiveDocs.Content.props} />
|
|
314
|
+
|
|
315
|
+
#### Item
|
|
316
|
+
|
|
317
|
+
Menu item slot inside the overflow menu. Renders a `<div>` element unless `asChild` is set.
|
|
318
|
+
|
|
319
|
+
```tsx
|
|
320
|
+
<ThreadListItemMorePrimitive.Item>Archive</ThreadListItemMorePrimitive.Item>
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
#### Separator
|
|
324
|
+
|
|
325
|
+
Visual separator between groups of menu items. Renders a `<div>` element unless `asChild` is set.
|
|
326
|
+
|
|
327
|
+
```tsx
|
|
328
|
+
<ThreadListItemMorePrimitive.Separator className="my-1 h-px bg-border" />
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
## Patterns
|
|
332
|
+
|
|
333
|
+
### Basic Thread List with New Button
|
|
334
|
+
|
|
335
|
+
```tsx
|
|
336
|
+
<ThreadListPrimitive.Root className="flex flex-col gap-1">
|
|
337
|
+
<ThreadListPrimitive.New className="flex items-center gap-2 rounded-lg border px-3 py-2 text-sm">
|
|
338
|
+
<PlusIcon className="size-4" /> New Thread
|
|
339
|
+
</ThreadListPrimitive.New>
|
|
340
|
+
<ThreadListPrimitive.Items>
|
|
341
|
+
{() => <ThreadListItem />}
|
|
342
|
+
</ThreadListPrimitive.Items>
|
|
343
|
+
</ThreadListPrimitive.Root>
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### Thread Item with More Menu
|
|
347
|
+
|
|
348
|
+
```tsx
|
|
349
|
+
function ThreadListItem() {
|
|
350
|
+
return (
|
|
351
|
+
<ThreadListItemPrimitive.Root className="group flex items-center rounded-lg hover:bg-muted data-active:bg-muted">
|
|
352
|
+
<ThreadListItemPrimitive.Trigger className="flex-1 truncate px-3 py-2 text-sm">
|
|
353
|
+
<ThreadListItemPrimitive.Title fallback="New Chat" />
|
|
354
|
+
</ThreadListItemPrimitive.Trigger>
|
|
355
|
+
<ThreadListItemMorePrimitive.Root>
|
|
356
|
+
<ThreadListItemMorePrimitive.Trigger className="opacity-0 group-hover:opacity-100">
|
|
357
|
+
<MoreHorizontalIcon className="size-4" />
|
|
358
|
+
</ThreadListItemMorePrimitive.Trigger>
|
|
359
|
+
<ThreadListItemMorePrimitive.Content>
|
|
360
|
+
<ThreadListItemPrimitive.Archive asChild>
|
|
361
|
+
<ThreadListItemMorePrimitive.Item>Archive</ThreadListItemMorePrimitive.Item>
|
|
362
|
+
</ThreadListItemPrimitive.Archive>
|
|
363
|
+
<ThreadListItemMorePrimitive.Separator />
|
|
364
|
+
<ThreadListItemPrimitive.Delete asChild>
|
|
365
|
+
<ThreadListItemMorePrimitive.Item>Delete</ThreadListItemMorePrimitive.Item>
|
|
366
|
+
</ThreadListItemPrimitive.Delete>
|
|
367
|
+
</ThreadListItemMorePrimitive.Content>
|
|
368
|
+
</ThreadListItemMorePrimitive.Root>
|
|
369
|
+
</ThreadListItemPrimitive.Root>
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Archived Threads Section
|
|
375
|
+
|
|
376
|
+
```tsx
|
|
377
|
+
<ThreadListPrimitive.Root>
|
|
378
|
+
<ThreadListPrimitive.New>New Thread</ThreadListPrimitive.New>
|
|
379
|
+
|
|
380
|
+
<h3 className="px-3 pt-4 text-xs font-medium text-muted-foreground">Recent</h3>
|
|
381
|
+
<ThreadListPrimitive.Items>
|
|
382
|
+
{() => <ThreadListItem />}
|
|
383
|
+
</ThreadListPrimitive.Items>
|
|
384
|
+
|
|
385
|
+
<h3 className="px-3 pt-4 text-xs font-medium text-muted-foreground">Archived</h3>
|
|
386
|
+
<ThreadListPrimitive.Items archived>
|
|
387
|
+
{() => <ArchivedItem />}
|
|
388
|
+
</ThreadListPrimitive.Items>
|
|
389
|
+
</ThreadListPrimitive.Root>
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
In the `ArchivedItem` component, use `ThreadListItemPrimitive.Unarchive` instead of `Archive` to let users restore threads.
|
|
393
|
+
|
|
394
|
+
## Relationship to Components
|
|
395
|
+
|
|
396
|
+
The shadcn [ThreadList](/docs/ui/thread-list) component wraps these primitives with Tailwind styling in a sidebar layout, including a skeleton loading state and a prebuilt more menu with archive and delete actions. Start there for a default thread list implementation. Reach for the primitives directly when you need a custom layout, different actions, or integration with your own sidebar or navigation system.
|
|
397
|
+
|
|
398
|
+
## API Reference
|
|
399
|
+
|
|
400
|
+
For full prop details on every part, see the API reference for each namespace:
|
|
401
|
+
|
|
402
|
+
- [ThreadListPrimitive](/docs/api-reference/primitives/thread-list)
|
|
403
|
+
- [ThreadListItemPrimitive](/docs/api-reference/primitives/thread-list-item)
|
|
404
|
+
- [ThreadListItemMorePrimitive](/docs/api-reference/primitives/thread-list-item-more)
|