@assistant-ui/mcp-docs-server 0.1.7 → 0.1.9
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/with-ai-sdk-v5.md +24 -15
- package/.docs/organized/code-examples/with-assistant-transport.md +1599 -0
- package/.docs/organized/code-examples/with-cloud.md +12 -10
- package/.docs/organized/code-examples/with-external-store.md +10 -8
- package/.docs/organized/code-examples/with-ffmpeg.md +17 -14
- package/.docs/organized/code-examples/with-langgraph.md +83 -47
- package/.docs/organized/code-examples/with-parent-id-grouping.md +10 -8
- package/.docs/organized/code-examples/with-react-hook-form.md +17 -14
- package/.docs/raw/docs/api-reference/integrations/react-data-stream.mdx +194 -0
- package/.docs/raw/docs/api-reference/overview.mdx +6 -0
- package/.docs/raw/docs/api-reference/primitives/Composer.mdx +31 -0
- package/.docs/raw/docs/api-reference/primitives/Message.mdx +108 -3
- package/.docs/raw/docs/api-reference/primitives/Thread.mdx +59 -0
- package/.docs/raw/docs/api-reference/primitives/ThreadList.mdx +128 -0
- package/.docs/raw/docs/api-reference/primitives/ThreadListItem.mdx +160 -0
- package/.docs/raw/docs/api-reference/runtimes/AssistantRuntime.mdx +0 -11
- package/.docs/raw/docs/api-reference/runtimes/ComposerRuntime.mdx +3 -3
- package/.docs/raw/docs/copilots/assistant-frame.mdx +399 -0
- package/.docs/raw/docs/devtools.mdx +51 -0
- package/.docs/raw/docs/getting-started.mdx +20 -19
- package/.docs/raw/docs/guides/Attachments.mdx +6 -13
- package/.docs/raw/docs/guides/Tools.mdx +56 -13
- package/.docs/raw/docs/guides/context-api.mdx +574 -0
- package/.docs/raw/docs/migrations/v0-12.mdx +125 -0
- package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +2 -2
- package/.docs/raw/docs/runtimes/custom/local.mdx +17 -4
- package/.docs/raw/docs/runtimes/data-stream.mdx +287 -0
- package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +6 -5
- package/.docs/raw/docs/runtimes/mastra/overview.mdx +3 -3
- package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +13 -13
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +5 -0
- package/.docs/raw/docs/ui/ThreadList.mdx +54 -16
- package/dist/{chunk-L4K23SWI.js → chunk-NVNFQ5ZO.js} +4 -1
- package/dist/index.js +1 -1
- package/dist/prepare-docs/prepare.js +1 -1
- package/dist/stdio.js +1 -1
- package/package.json +7 -7
- package/.docs/raw/docs/concepts/architecture.mdx +0 -19
- package/.docs/raw/docs/concepts/runtime-layer.mdx +0 -163
- package/.docs/raw/docs/concepts/why.mdx +0 -9
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "@assistant-ui/react-data-stream"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Data Stream protocol integration for assistant-ui.
|
|
6
|
+
|
|
7
|
+
import { ParametersTable } from "@/components/docs";
|
|
8
|
+
|
|
9
|
+
## API Reference
|
|
10
|
+
|
|
11
|
+
### `useDataStreamRuntime`
|
|
12
|
+
|
|
13
|
+
Create a runtime that connects to a data stream protocol endpoint.
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { useDataStreamRuntime } from "@assistant-ui/react-data-stream";
|
|
17
|
+
|
|
18
|
+
const MyRuntimeProvider = ({ children }: { children: React.ReactNode }) => {
|
|
19
|
+
const runtime = useDataStreamRuntime({
|
|
20
|
+
api: "/api/chat",
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<AssistantRuntimeProvider runtime={runtime}>
|
|
25
|
+
{children}
|
|
26
|
+
</AssistantRuntimeProvider>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
<ParametersTable
|
|
32
|
+
parameters={[
|
|
33
|
+
{
|
|
34
|
+
name: "api",
|
|
35
|
+
type: "string",
|
|
36
|
+
description: "The API endpoint URL for the data stream protocol.",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "onResponse",
|
|
40
|
+
type: "(response: Response) => void | Promise<void>",
|
|
41
|
+
description: "Optional callback called when a response is received.",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "onFinish",
|
|
45
|
+
type: "(message: ThreadMessage) => void",
|
|
46
|
+
description: "Optional callback called when a message is finished.",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "onError",
|
|
50
|
+
type: "(error: Error) => void",
|
|
51
|
+
description: "Optional callback called when an error occurs.",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "onCancel",
|
|
55
|
+
type: "() => void",
|
|
56
|
+
description: "Optional callback called when a request is cancelled.",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "credentials",
|
|
60
|
+
type: "RequestCredentials",
|
|
61
|
+
description: "Optional credentials mode for the fetch request.",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "headers",
|
|
65
|
+
type: "Record<string, string> | Headers | (() => Promise<Record<string, string> | Headers>)",
|
|
66
|
+
description: "Optional headers to include in the request.",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "body",
|
|
70
|
+
type: "object",
|
|
71
|
+
description: "Optional additional body parameters to include in the request.",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "sendExtraMessageFields",
|
|
75
|
+
type: "boolean",
|
|
76
|
+
description: "Whether to include extra message fields like IDs in the request.",
|
|
77
|
+
},
|
|
78
|
+
]}
|
|
79
|
+
/>
|
|
80
|
+
|
|
81
|
+
### `useCloudRuntime`
|
|
82
|
+
|
|
83
|
+
Create a runtime that connects to Assistant Cloud using the data stream protocol.
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
import { useCloudRuntime } from "@assistant-ui/react-data-stream";
|
|
87
|
+
|
|
88
|
+
const MyRuntimeProvider = ({ children }: { children: React.ReactNode }) => {
|
|
89
|
+
const runtime = useCloudRuntime({
|
|
90
|
+
cloud: assistantCloud,
|
|
91
|
+
assistantId: "my-assistant-id",
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<AssistantRuntimeProvider runtime={runtime}>
|
|
96
|
+
{children}
|
|
97
|
+
</AssistantRuntimeProvider>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
<ParametersTable
|
|
103
|
+
parameters={[
|
|
104
|
+
{
|
|
105
|
+
name: "cloud",
|
|
106
|
+
type: "AssistantCloud",
|
|
107
|
+
description: "The Assistant Cloud instance.",
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "assistantId",
|
|
111
|
+
type: "string",
|
|
112
|
+
description: "The ID of the assistant to connect to.",
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "onResponse",
|
|
116
|
+
type: "(response: Response) => void | Promise<void>",
|
|
117
|
+
description: "Optional callback called when a response is received.",
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: "onFinish",
|
|
121
|
+
type: "(message: ThreadMessage) => void",
|
|
122
|
+
description: "Optional callback called when a message is finished.",
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "onError",
|
|
126
|
+
type: "(error: Error) => void",
|
|
127
|
+
description: "Optional callback called when an error occurs.",
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "onCancel",
|
|
131
|
+
type: "() => void",
|
|
132
|
+
description: "Optional callback called when a request is cancelled.",
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "credentials",
|
|
136
|
+
type: "RequestCredentials",
|
|
137
|
+
description: "Optional credentials mode for the fetch request.",
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: "headers",
|
|
141
|
+
type: "Record<string, string> | Headers | (() => Promise<Record<string, string> | Headers>)",
|
|
142
|
+
description: "Optional headers to include in the request.",
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: "body",
|
|
146
|
+
type: "object",
|
|
147
|
+
description: "Optional additional body parameters to include in the request.",
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: "sendExtraMessageFields",
|
|
151
|
+
type: "boolean",
|
|
152
|
+
description: "Whether to include extra message fields like IDs in the request.",
|
|
153
|
+
},
|
|
154
|
+
]}
|
|
155
|
+
/>
|
|
156
|
+
|
|
157
|
+
### `toLanguageModelMessages`
|
|
158
|
+
|
|
159
|
+
Convert assistant-ui messages to language model format.
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
import { toLanguageModelMessages } from "@assistant-ui/react-data-stream";
|
|
163
|
+
|
|
164
|
+
const languageModelMessages = toLanguageModelMessages(messages, {
|
|
165
|
+
unstable_includeId: true,
|
|
166
|
+
});
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
<ParametersTable
|
|
170
|
+
parameters={[
|
|
171
|
+
{
|
|
172
|
+
name: "messages",
|
|
173
|
+
type: "readonly ThreadMessage[]",
|
|
174
|
+
description: "The messages to convert.",
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: "options",
|
|
178
|
+
type: "{ unstable_includeId?: boolean }",
|
|
179
|
+
description: "Optional conversion options.",
|
|
180
|
+
children: [
|
|
181
|
+
{
|
|
182
|
+
type: "{ unstable_includeId?: boolean }",
|
|
183
|
+
parameters: [
|
|
184
|
+
{
|
|
185
|
+
name: "unstable_includeId",
|
|
186
|
+
type: "boolean",
|
|
187
|
+
description: "Whether to include message IDs in the converted messages.",
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
},
|
|
193
|
+
]}
|
|
194
|
+
/>
|
|
@@ -31,6 +31,12 @@ export const contextColors = {
|
|
|
31
31
|
- [`useChatRuntime`](#use-chat-runtime)
|
|
32
32
|
- [`useAISDKRuntime`](#use-aisdk-runtime)
|
|
33
33
|
|
|
34
|
+
### Data Stream
|
|
35
|
+
|
|
36
|
+
- [`useDataStreamRuntime`](#use-data-stream-runtime)
|
|
37
|
+
- [`useCloudRuntime`](#use-cloud-runtime)
|
|
38
|
+
- [`toLanguageModelMessages`](#to-language-model-messages)
|
|
39
|
+
|
|
34
40
|
### LangGraph
|
|
35
41
|
|
|
36
42
|
- [`useLangGraphRuntime`](#use-lang-graph-runtime)
|
|
@@ -168,6 +168,37 @@ Renders attachments. This primitive renders a separate component for each attach
|
|
|
168
168
|
]}
|
|
169
169
|
/>
|
|
170
170
|
|
|
171
|
+
### AttachmentByIndex
|
|
172
|
+
|
|
173
|
+
Renders a single attachment at the specified index within the composer.
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
<ComposerPrimitive.AttachmentByIndex
|
|
177
|
+
index={0}
|
|
178
|
+
components={{
|
|
179
|
+
Image: MyImageAttachment,
|
|
180
|
+
Document: MyDocumentAttachment
|
|
181
|
+
}}
|
|
182
|
+
/>
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
<ParametersTable
|
|
186
|
+
type="ComposerPrimitive.AttachmentByIndex.Props"
|
|
187
|
+
parameters={[
|
|
188
|
+
{
|
|
189
|
+
name: "index",
|
|
190
|
+
type: "number",
|
|
191
|
+
required: true,
|
|
192
|
+
description: "The index of the attachment to render.",
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: "components",
|
|
196
|
+
type: "ComposerAttachmentsComponents",
|
|
197
|
+
description: "The components to render for the attachment.",
|
|
198
|
+
},
|
|
199
|
+
]}
|
|
200
|
+
/>
|
|
201
|
+
|
|
171
202
|
### AddAttachment
|
|
172
203
|
|
|
173
204
|
Renders a button to add an attachment.
|
|
@@ -13,7 +13,7 @@ import { MessagePrimitive } from "@assistant-ui/react";
|
|
|
13
13
|
|
|
14
14
|
const UserMessage = () => (
|
|
15
15
|
<MessagePrimitive.Root>
|
|
16
|
-
User: <MessagePrimitive.
|
|
16
|
+
User: <MessagePrimitive.Parts />
|
|
17
17
|
<BranchPicker />
|
|
18
18
|
<ActionBar />
|
|
19
19
|
</MessagePrimitive.Root>
|
|
@@ -21,7 +21,7 @@ const UserMessage = () => (
|
|
|
21
21
|
|
|
22
22
|
const AssistantMessage = () => (
|
|
23
23
|
<MessagePrimitive.Root>
|
|
24
|
-
Assistant: <MessagePrimitive.
|
|
24
|
+
Assistant: <MessagePrimitive.Parts />
|
|
25
25
|
<BranchPicker />
|
|
26
26
|
<ActionBar />
|
|
27
27
|
</MessagePrimitive.Root>
|
|
@@ -45,7 +45,7 @@ This primitive renders a `<div>` element unless `asChild` is set.
|
|
|
45
45
|
]}
|
|
46
46
|
/>
|
|
47
47
|
|
|
48
|
-
###
|
|
48
|
+
### Parts
|
|
49
49
|
|
|
50
50
|
The content of the message. This renders a separate component for each content part of the message.
|
|
51
51
|
|
|
@@ -154,6 +154,111 @@ The content of the message. This renders a separate component for each content p
|
|
|
154
154
|
]}
|
|
155
155
|
/>
|
|
156
156
|
|
|
157
|
+
### PartByIndex
|
|
158
|
+
|
|
159
|
+
Renders a single message part at the specified index.
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
<MessagePrimitive.PartByIndex
|
|
163
|
+
index={0}
|
|
164
|
+
components={{
|
|
165
|
+
Text: MyTextComponent,
|
|
166
|
+
Image: MyImageComponent
|
|
167
|
+
}}
|
|
168
|
+
/>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
<ParametersTable
|
|
172
|
+
type="MessagePrimitive.PartByIndex.Props"
|
|
173
|
+
parameters={[
|
|
174
|
+
{
|
|
175
|
+
name: "index",
|
|
176
|
+
type: "number",
|
|
177
|
+
required: true,
|
|
178
|
+
description: "The index of the message part to render.",
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: "components",
|
|
182
|
+
required: false,
|
|
183
|
+
type: "ContentPartComponents",
|
|
184
|
+
description: "The components to render for the message part.",
|
|
185
|
+
},
|
|
186
|
+
]}
|
|
187
|
+
/>
|
|
188
|
+
|
|
189
|
+
### Attachments
|
|
190
|
+
|
|
191
|
+
Renders all attachments of the message.
|
|
192
|
+
|
|
193
|
+
<ParametersTable
|
|
194
|
+
type="MessagePrimitive.Attachments.Props"
|
|
195
|
+
parameters={[
|
|
196
|
+
{
|
|
197
|
+
name: "components",
|
|
198
|
+
type: "AttachmentComponents",
|
|
199
|
+
description: "The components to render for each attachment.",
|
|
200
|
+
children: [
|
|
201
|
+
{
|
|
202
|
+
type: "AttachmentComponents",
|
|
203
|
+
parameters: [
|
|
204
|
+
{
|
|
205
|
+
name: "Image",
|
|
206
|
+
type: "ComponentType",
|
|
207
|
+
description: "The component to render for image attachments.",
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: "Document",
|
|
211
|
+
type: "ComponentType",
|
|
212
|
+
description: "The component to render for document attachments.",
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
name: "File",
|
|
216
|
+
type: "ComponentType",
|
|
217
|
+
description: "The component to render for file attachments.",
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
name: "Attachment",
|
|
221
|
+
type: "ComponentType",
|
|
222
|
+
description: "The fallback component to render for any attachment type.",
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
},
|
|
226
|
+
],
|
|
227
|
+
},
|
|
228
|
+
]}
|
|
229
|
+
/>
|
|
230
|
+
|
|
231
|
+
### AttachmentByIndex
|
|
232
|
+
|
|
233
|
+
Renders a single attachment at the specified index within the message.
|
|
234
|
+
|
|
235
|
+
```tsx
|
|
236
|
+
<MessagePrimitive.AttachmentByIndex
|
|
237
|
+
index={0}
|
|
238
|
+
components={{
|
|
239
|
+
Image: MyImageAttachment,
|
|
240
|
+
Document: MyDocumentAttachment
|
|
241
|
+
}}
|
|
242
|
+
/>
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
<ParametersTable
|
|
246
|
+
type="MessagePrimitive.AttachmentByIndex.Props"
|
|
247
|
+
parameters={[
|
|
248
|
+
{
|
|
249
|
+
name: "index",
|
|
250
|
+
type: "number",
|
|
251
|
+
required: true,
|
|
252
|
+
description: "The index of the attachment to render.",
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
name: "components",
|
|
256
|
+
type: "AttachmentComponents",
|
|
257
|
+
description: "The components to render for the attachment.",
|
|
258
|
+
},
|
|
259
|
+
]}
|
|
260
|
+
/>
|
|
261
|
+
|
|
157
262
|
### If
|
|
158
263
|
|
|
159
264
|
Renders children if a condition is met.
|
|
@@ -104,6 +104,65 @@ Renders all messages. This primitive renders a separate component for each messa
|
|
|
104
104
|
]}
|
|
105
105
|
/>
|
|
106
106
|
|
|
107
|
+
### MessageByIndex
|
|
108
|
+
|
|
109
|
+
Renders a single message at the specified index in the current thread.
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
<ThreadPrimitive.MessageByIndex
|
|
113
|
+
index={0}
|
|
114
|
+
components={{
|
|
115
|
+
UserMessage: MyUserMessage,
|
|
116
|
+
AssistantMessage: MyAssistantMessage
|
|
117
|
+
}}
|
|
118
|
+
/>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
<ParametersTable
|
|
122
|
+
type="ThreadPrimitive.MessageByIndex.Props"
|
|
123
|
+
parameters={[
|
|
124
|
+
{
|
|
125
|
+
name: "index",
|
|
126
|
+
type: "number",
|
|
127
|
+
required: true,
|
|
128
|
+
description: "The index of the message to render.",
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "components",
|
|
132
|
+
type: "MessageComponents",
|
|
133
|
+
description: "The component configuration for rendering the message.",
|
|
134
|
+
children: [
|
|
135
|
+
{
|
|
136
|
+
type: "MessageComponents",
|
|
137
|
+
parameters: [
|
|
138
|
+
{
|
|
139
|
+
name: "Message",
|
|
140
|
+
type: "ComponentType",
|
|
141
|
+
description: "The component to render for each message.",
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: "UserMessage",
|
|
145
|
+
type: "ComponentType",
|
|
146
|
+
description: "The component to render for user messages.",
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: "EditComposer",
|
|
150
|
+
type: "ComponentType",
|
|
151
|
+
description:
|
|
152
|
+
"The component to render for user messages that are being edited.",
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: "AssistantMessage",
|
|
156
|
+
type: "ComponentType",
|
|
157
|
+
description: "The component to render for assistant messages.",
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
},
|
|
163
|
+
]}
|
|
164
|
+
/>
|
|
165
|
+
|
|
107
166
|
### Empty
|
|
108
167
|
|
|
109
168
|
Renders children only when there are no messages.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ThreadListPrimitive
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Displays a list of conversation threads.
|
|
6
|
+
|
|
7
|
+
import { ParametersTable } from "@/components/docs";
|
|
8
|
+
|
|
9
|
+
## Anatomy
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { ThreadListPrimitive } from "@assistant-ui/react";
|
|
13
|
+
|
|
14
|
+
const ThreadList = () => (
|
|
15
|
+
<ThreadListPrimitive.Root>
|
|
16
|
+
<ThreadListPrimitive.New />
|
|
17
|
+
<ThreadListPrimitive.Items
|
|
18
|
+
components={{
|
|
19
|
+
ThreadListItem: MyThreadListItem
|
|
20
|
+
}}
|
|
21
|
+
/>
|
|
22
|
+
</ThreadListPrimitive.Root>
|
|
23
|
+
);
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## API Reference
|
|
27
|
+
|
|
28
|
+
### Root
|
|
29
|
+
|
|
30
|
+
Contains all parts of the thread list.
|
|
31
|
+
|
|
32
|
+
This primitive renders a `<div>` element unless `asChild` is set.
|
|
33
|
+
|
|
34
|
+
<ParametersTable
|
|
35
|
+
type="ThreadListPrimitiveRootProps"
|
|
36
|
+
parameters={[
|
|
37
|
+
{
|
|
38
|
+
name: "asChild",
|
|
39
|
+
},
|
|
40
|
+
]}
|
|
41
|
+
/>
|
|
42
|
+
|
|
43
|
+
### New
|
|
44
|
+
|
|
45
|
+
A button to create a new thread.
|
|
46
|
+
|
|
47
|
+
This primitive renders a `<button>` element unless `asChild` is set.
|
|
48
|
+
|
|
49
|
+
<ParametersTable
|
|
50
|
+
type="ThreadListPrimitiveNewProps"
|
|
51
|
+
parameters={[
|
|
52
|
+
{
|
|
53
|
+
name: "asChild",
|
|
54
|
+
},
|
|
55
|
+
]}
|
|
56
|
+
/>
|
|
57
|
+
|
|
58
|
+
### Items
|
|
59
|
+
|
|
60
|
+
Renders all items in the thread list.
|
|
61
|
+
|
|
62
|
+
<ParametersTable
|
|
63
|
+
type="ThreadListPrimitive.Items.Props"
|
|
64
|
+
parameters={[
|
|
65
|
+
{
|
|
66
|
+
name: "archived",
|
|
67
|
+
type: "boolean",
|
|
68
|
+
default: "false",
|
|
69
|
+
description: "Whether to show archived threads instead of active threads.",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "components",
|
|
73
|
+
type: "ThreadListItemComponents",
|
|
74
|
+
required: true,
|
|
75
|
+
description: "The components to render for each thread list item.",
|
|
76
|
+
children: [
|
|
77
|
+
{
|
|
78
|
+
type: "ThreadListItemComponents",
|
|
79
|
+
parameters: [
|
|
80
|
+
{
|
|
81
|
+
name: "ThreadListItem",
|
|
82
|
+
type: "ComponentType",
|
|
83
|
+
required: true,
|
|
84
|
+
description: "The component to render for each thread in the list.",
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
]}
|
|
91
|
+
/>
|
|
92
|
+
|
|
93
|
+
### ItemByIndex
|
|
94
|
+
|
|
95
|
+
Renders a single thread list item at the specified index.
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
<ThreadListPrimitive.ItemByIndex
|
|
99
|
+
index={0}
|
|
100
|
+
components={{
|
|
101
|
+
ThreadListItem: MyThreadListItem
|
|
102
|
+
}}
|
|
103
|
+
/>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
<ParametersTable
|
|
107
|
+
type="ThreadListPrimitive.ItemByIndex.Props"
|
|
108
|
+
parameters={[
|
|
109
|
+
{
|
|
110
|
+
name: "index",
|
|
111
|
+
type: "number",
|
|
112
|
+
required: true,
|
|
113
|
+
description: "The index of the thread list item to render.",
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: "archived",
|
|
117
|
+
type: "boolean",
|
|
118
|
+
default: "false",
|
|
119
|
+
description: "Whether to render from archived threads instead of active threads.",
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: "components",
|
|
123
|
+
type: "ThreadListItemComponents",
|
|
124
|
+
required: true,
|
|
125
|
+
description: "The components to render for the thread list item.",
|
|
126
|
+
},
|
|
127
|
+
]}
|
|
128
|
+
/>
|