@assistant-ui/mcp-docs-server 0.1.18 → 0.1.20
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-ag-ui.md +69 -1336
- package/.docs/organized/code-examples/with-ai-sdk-v6.md +429 -0
- package/.docs/organized/code-examples/with-assistant-transport.md +41 -1454
- package/.docs/organized/code-examples/with-cloud.md +73 -1442
- package/.docs/organized/code-examples/with-custom-thread-list.md +95 -1424
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +674 -0
- package/.docs/organized/code-examples/with-external-store.md +68 -1334
- package/.docs/organized/code-examples/with-ffmpeg.md +73 -1341
- package/.docs/organized/code-examples/with-langgraph.md +52 -1545
- package/.docs/organized/code-examples/with-parent-id-grouping.md +58 -1364
- package/.docs/organized/code-examples/with-react-hook-form.md +73 -1726
- package/.docs/organized/code-examples/with-react-router.md +915 -0
- package/.docs/organized/code-examples/with-store.md +31 -31
- package/.docs/organized/code-examples/with-tanstack.md +78 -862
- package/.docs/raw/blog/2025-01-31-changelog/index.mdx +0 -2
- package/.docs/raw/docs/{architecture.mdx → (docs)/architecture.mdx} +3 -2
- package/.docs/raw/docs/{cli.mdx → (docs)/cli.mdx} +66 -18
- package/.docs/raw/docs/{copilots → (docs)/copilots}/make-assistant-readable.mdx +1 -0
- package/.docs/raw/docs/{copilots → (docs)/copilots}/make-assistant-tool-ui.mdx +2 -1
- package/.docs/raw/docs/{copilots → (docs)/copilots}/make-assistant-tool.mdx +2 -1
- package/.docs/raw/docs/{copilots → (docs)/copilots}/model-context.mdx +5 -4
- package/.docs/raw/docs/{copilots → (docs)/copilots}/motivation.mdx +4 -3
- package/.docs/raw/docs/{copilots → (docs)/copilots}/use-assistant-instructions.mdx +1 -0
- package/.docs/raw/docs/{devtools.mdx → (docs)/devtools.mdx} +4 -4
- package/.docs/raw/docs/{guides/Attachments.mdx → (docs)/guides/attachments.mdx} +6 -7
- package/.docs/raw/docs/{guides/Branching.mdx → (docs)/guides/branching.mdx} +2 -1
- package/.docs/raw/docs/{guides → (docs)/guides}/context-api.mdx +118 -117
- package/.docs/raw/docs/(docs)/guides/dictation.mdx +370 -0
- package/.docs/raw/docs/{guides/Editing.mdx → (docs)/guides/editing.mdx} +1 -0
- package/.docs/raw/docs/{guides/Latex.mdx → (docs)/guides/latex.mdx} +1 -2
- package/.docs/raw/docs/{guides/Speech.mdx → (docs)/guides/speech.mdx} +9 -10
- package/.docs/raw/docs/(docs)/guides/suggestions.mdx +296 -0
- package/.docs/raw/docs/{guides/ToolUI.mdx → (docs)/guides/tool-ui.mdx} +15 -14
- package/.docs/raw/docs/(docs)/guides/tools.mdx +564 -0
- package/.docs/raw/docs/(docs)/index.mdx +74 -0
- package/.docs/raw/docs/{getting-started.mdx → (docs)/installation.mdx} +18 -23
- package/.docs/raw/docs/(docs)/llm.mdx +209 -0
- package/.docs/raw/docs/{api-reference/context-providers/AssistantRuntimeProvider.mdx → (reference)/api-reference/context-providers/assistant-runtime-provider.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/context-providers/TextMessagePartProvider.mdx → (reference)/api-reference/context-providers/text-message-part-provider.mdx} +2 -1
- package/.docs/raw/docs/{api-reference → (reference)/api-reference}/integrations/react-data-stream.mdx +50 -3
- package/.docs/raw/docs/{api-reference → (reference)/api-reference}/integrations/react-hook-form.mdx +2 -1
- package/.docs/raw/docs/{api-reference → (reference)/api-reference}/integrations/vercel-ai-sdk.mdx +2 -2
- package/.docs/raw/docs/{api-reference → (reference)/api-reference}/overview.mdx +10 -4
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +327 -0
- package/.docs/raw/docs/{api-reference/primitives/ActionBar.mdx → (reference)/api-reference/primitives/action-bar.mdx} +7 -5
- package/.docs/raw/docs/{api-reference/primitives/AssistantIf.mdx → (reference)/api-reference/primitives/assistant-if.mdx} +51 -51
- package/.docs/raw/docs/{api-reference/primitives/AssistantModal.mdx → (reference)/api-reference/primitives/assistant-modal.mdx} +3 -1
- package/.docs/raw/docs/{api-reference/primitives/Attachment.mdx → (reference)/api-reference/primitives/attachment.mdx} +3 -2
- package/.docs/raw/docs/{api-reference/primitives/BranchPicker.mdx → (reference)/api-reference/primitives/branch-picker.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/primitives/Composer.mdx → (reference)/api-reference/primitives/composer.mdx} +101 -2
- package/.docs/raw/docs/{api-reference → (reference)/api-reference}/primitives/composition.mdx +1 -0
- package/.docs/raw/docs/{api-reference/primitives/Error.mdx → (reference)/api-reference/primitives/error.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/primitives/MessagePart.mdx → (reference)/api-reference/primitives/message-part.mdx} +2 -2
- package/.docs/raw/docs/{api-reference/primitives/Message.mdx → (reference)/api-reference/primitives/message.mdx} +2 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +153 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item-more.mdx +221 -0
- package/.docs/raw/docs/{api-reference/primitives/ThreadListItem.mdx → (reference)/api-reference/primitives/thread-list-item.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/primitives/ThreadList.mdx → (reference)/api-reference/primitives/thread-list.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/primitives/Thread.mdx → (reference)/api-reference/primitives/thread.mdx} +30 -40
- package/.docs/raw/docs/{api-reference/runtimes/AssistantRuntime.mdx → (reference)/api-reference/runtimes/assistant-runtime.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/runtimes/AttachmentRuntime.mdx → (reference)/api-reference/runtimes/attachment-runtime.mdx} +3 -2
- package/.docs/raw/docs/{api-reference/runtimes/ComposerRuntime.mdx → (reference)/api-reference/runtimes/composer-runtime.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/runtimes/MessagePartRuntime.mdx → (reference)/api-reference/runtimes/message-part-runtime.mdx} +3 -2
- package/.docs/raw/docs/{api-reference/runtimes/MessageRuntime.mdx → (reference)/api-reference/runtimes/message-runtime.mdx} +3 -2
- package/.docs/raw/docs/{api-reference/runtimes/ThreadListItemRuntime.mdx → (reference)/api-reference/runtimes/thread-list-item-runtime.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/runtimes/ThreadListRuntime.mdx → (reference)/api-reference/runtimes/thread-list-runtime.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/runtimes/ThreadRuntime.mdx → (reference)/api-reference/runtimes/thread-runtime.mdx} +3 -5
- package/.docs/raw/docs/{legacy/styled/AssistantModal.mdx → (reference)/legacy/styled/assistant-modal.mdx} +2 -3
- package/.docs/raw/docs/{legacy/styled/Decomposition.mdx → (reference)/legacy/styled/decomposition.mdx} +6 -5
- package/.docs/raw/docs/{legacy/styled/Markdown.mdx → (reference)/legacy/styled/markdown.mdx} +2 -4
- package/.docs/raw/docs/{legacy/styled/Scrollbar.mdx → (reference)/legacy/styled/scrollbar.mdx} +2 -1
- package/.docs/raw/docs/{legacy/styled/ThreadWidth.mdx → (reference)/legacy/styled/thread-width.mdx} +1 -0
- package/.docs/raw/docs/{legacy/styled/Thread.mdx → (reference)/legacy/styled/thread.mdx} +2 -3
- package/.docs/raw/docs/{migrations → (reference)/migrations}/deprecation-policy.mdx +1 -0
- package/.docs/raw/docs/{migrations → (reference)/migrations}/react-langgraph-v0-7.mdx +1 -2
- package/.docs/raw/docs/{migrations → (reference)/migrations}/v0-11.mdx +1 -0
- package/.docs/raw/docs/(reference)/migrations/v0-12.mdx +300 -0
- package/.docs/raw/docs/{react-compatibility.mdx → (reference)/react-compatibility.mdx} +2 -3
- package/.docs/raw/docs/cloud/authorization.mdx +1 -0
- package/.docs/raw/docs/cloud/overview.mdx +1 -0
- package/.docs/raw/docs/cloud/persistence/ai-sdk.mdx +2 -3
- package/.docs/raw/docs/cloud/persistence/langgraph.mdx +5 -7
- package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +9 -8
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +2 -3
- package/.docs/raw/docs/runtimes/assistant-transport.mdx +10 -9
- package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +7 -8
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +6 -8
- package/.docs/raw/docs/runtimes/custom/local.mdx +55 -42
- package/.docs/raw/docs/runtimes/data-stream.mdx +67 -6
- package/.docs/raw/docs/runtimes/helicone.mdx +1 -0
- package/.docs/raw/docs/runtimes/langgraph/index.mdx +3 -3
- package/.docs/raw/docs/runtimes/langgraph/tutorial/index.mdx +1 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +1 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +1 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +1 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +2 -1
- package/.docs/raw/docs/runtimes/langserve.mdx +2 -2
- package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +4 -5
- package/.docs/raw/docs/runtimes/mastra/overview.mdx +1 -0
- package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +3 -4
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +2 -4
- package/.docs/raw/docs/ui/accordion.mdx +261 -0
- package/.docs/raw/docs/ui/assistant-modal.mdx +163 -0
- package/.docs/raw/docs/ui/assistant-sidebar.mdx +90 -0
- package/.docs/raw/docs/ui/attachment.mdx +227 -0
- package/.docs/raw/docs/ui/badge.mdx +140 -0
- package/.docs/raw/docs/ui/file.mdx +153 -0
- package/.docs/raw/docs/ui/image.mdx +101 -0
- package/.docs/raw/docs/ui/{Markdown.mdx → markdown.mdx} +11 -6
- package/.docs/raw/docs/ui/{Mermaid.mdx → mermaid.mdx} +12 -5
- package/.docs/raw/docs/ui/model-selector.mdx +226 -0
- package/.docs/raw/docs/ui/{PartGrouping.mdx → part-grouping.mdx} +6 -8
- package/.docs/raw/docs/ui/reasoning.mdx +150 -0
- package/.docs/raw/docs/ui/{Scrollbar.mdx → scrollbar.mdx} +9 -1
- package/.docs/raw/docs/ui/select.mdx +247 -0
- package/.docs/raw/docs/ui/sources.mdx +89 -0
- package/.docs/raw/docs/ui/streamdown.mdx +348 -0
- package/.docs/raw/docs/ui/{SyntaxHighlighting.mdx → syntax-highlighting.mdx} +9 -5
- package/.docs/raw/docs/ui/tabs.mdx +261 -0
- package/.docs/raw/docs/ui/thread-list.mdx +275 -0
- package/.docs/raw/docs/ui/{Thread.mdx → thread.mdx} +61 -76
- package/.docs/raw/docs/ui/tool-fallback.mdx +112 -0
- package/.docs/raw/docs/ui/tool-group.mdx +214 -0
- package/README.md +3 -3
- package/dist/tools/docs.js +1 -1
- package/dist/tools/examples.js +1 -1
- package/dist/tools/examples.js.map +1 -1
- package/package.json +5 -5
- package/src/tools/docs.ts +1 -1
- package/src/tools/examples.ts +1 -1
- package/src/tools/tests/docs.test.ts +18 -16
- package/src/tools/tests/examples.test.ts +6 -6
- package/src/tools/tests/path-traversal.test.ts +3 -3
- package/src/utils/tests/security.test.ts +3 -3
- package/.docs/organized/code-examples/with-ai-sdk-v5.md +0 -1735
- package/.docs/raw/docs/about-assistantui.mdx +0 -53
- package/.docs/raw/docs/guides/Tools.mdx +0 -738
- package/.docs/raw/docs/index.mdx +0 -7
- package/.docs/raw/docs/mcp-docs-server.mdx +0 -322
- package/.docs/raw/docs/migrations/v0-12.mdx +0 -125
- package/.docs/raw/docs/ui/AssistantModal.mdx +0 -45
- package/.docs/raw/docs/ui/AssistantSidebar.mdx +0 -41
- package/.docs/raw/docs/ui/Attachment.mdx +0 -84
- package/.docs/raw/docs/ui/Reasoning.mdx +0 -152
- package/.docs/raw/docs/ui/ThreadList.mdx +0 -90
- package/.docs/raw/docs/ui/ToolFallback.mdx +0 -63
- package/.docs/raw/docs/ui/ToolGroup.mdx +0 -96
- /package/.docs/raw/docs/{copilots → (docs)/copilots}/assistant-frame.mdx +0 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Attachment
|
|
3
|
+
description: UI components for attaching and viewing files in messages.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { ParametersTable } from "@/components/docs/tables/ParametersTable";
|
|
7
|
+
import { AttachmentSample } from "@/components/docs/samples/attachment";
|
|
8
|
+
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
9
|
+
|
|
10
|
+
<AttachmentSample />
|
|
11
|
+
|
|
12
|
+
<Callout type="info">
|
|
13
|
+
**Note:** These components provide the UI for attachments, but you also need
|
|
14
|
+
to configure attachment adapters in your runtime to handle file uploads and
|
|
15
|
+
processing. See the [Attachments Guide](/docs/guides/attachments) for complete
|
|
16
|
+
setup instructions.
|
|
17
|
+
</Callout>
|
|
18
|
+
|
|
19
|
+
## Getting Started
|
|
20
|
+
|
|
21
|
+
<Steps>
|
|
22
|
+
<Step>
|
|
23
|
+
|
|
24
|
+
### Add `attachment`
|
|
25
|
+
|
|
26
|
+
<InstallCommand shadcn={["attachment"]} />
|
|
27
|
+
|
|
28
|
+
This adds a `/components/assistant-ui/attachment.tsx` file to your project, which you can adjust as needed.
|
|
29
|
+
|
|
30
|
+
</Step>
|
|
31
|
+
<Step>
|
|
32
|
+
|
|
33
|
+
### Use in your application
|
|
34
|
+
|
|
35
|
+
```tsx title="/components/assistant-ui/thread.tsx" {1-4,9-10}
|
|
36
|
+
import {
|
|
37
|
+
ComposerAttachments,
|
|
38
|
+
ComposerAddAttachment,
|
|
39
|
+
} from "@/components/assistant-ui/attachment";
|
|
40
|
+
|
|
41
|
+
const Composer: FC = () => {
|
|
42
|
+
return (
|
|
43
|
+
<ComposerPrimitive.Root className="...">
|
|
44
|
+
<ComposerAttachments />
|
|
45
|
+
<ComposerAddAttachment />
|
|
46
|
+
|
|
47
|
+
<ComposerPrimitive.Input
|
|
48
|
+
autoFocus
|
|
49
|
+
placeholder="Write a message..."
|
|
50
|
+
rows={1}
|
|
51
|
+
className="..."
|
|
52
|
+
/>
|
|
53
|
+
<ComposerAction />
|
|
54
|
+
</ComposerPrimitive.Root>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
```tsx title="/components/assistant-ui/thread.tsx" {1,8}
|
|
60
|
+
import { UserMessageAttachments } from "@/components/assistant-ui/attachment";
|
|
61
|
+
|
|
62
|
+
const UserMessage: FC = () => {
|
|
63
|
+
return (
|
|
64
|
+
<MessagePrimitive.Root className="...">
|
|
65
|
+
<UserActionBar />
|
|
66
|
+
|
|
67
|
+
<UserMessageAttachments />
|
|
68
|
+
|
|
69
|
+
<div className="...">
|
|
70
|
+
<MessagePrimitive.Parts />
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<BranchPicker className="..." />
|
|
74
|
+
</MessagePrimitive.Root>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
</Step>
|
|
80
|
+
</Steps>
|
|
81
|
+
|
|
82
|
+
## API Reference
|
|
83
|
+
|
|
84
|
+
### Composer Attachments
|
|
85
|
+
|
|
86
|
+
#### ComposerPrimitive.Attachments
|
|
87
|
+
|
|
88
|
+
Renders all attachments in the composer.
|
|
89
|
+
|
|
90
|
+
<ParametersTable
|
|
91
|
+
type="ComposerPrimitiveAttachmentsProps"
|
|
92
|
+
parameters={[
|
|
93
|
+
{
|
|
94
|
+
name: "components",
|
|
95
|
+
type: "AttachmentComponents",
|
|
96
|
+
description: "Components to render for different attachment types.",
|
|
97
|
+
children: [
|
|
98
|
+
{
|
|
99
|
+
type: "AttachmentComponents",
|
|
100
|
+
parameters: [
|
|
101
|
+
{
|
|
102
|
+
name: "Image",
|
|
103
|
+
type: "ComponentType",
|
|
104
|
+
description: "Component for image attachments.",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "Document",
|
|
108
|
+
type: "ComponentType",
|
|
109
|
+
description: "Component for document attachments (PDF, etc.).",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "File",
|
|
113
|
+
type: "ComponentType",
|
|
114
|
+
description: "Component for generic file attachments.",
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "Attachment",
|
|
118
|
+
type: "ComponentType",
|
|
119
|
+
description: "Fallback component for all attachment types.",
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
]}
|
|
126
|
+
/>
|
|
127
|
+
|
|
128
|
+
#### ComposerPrimitive.AddAttachment
|
|
129
|
+
|
|
130
|
+
A button that opens the file picker to add attachments.
|
|
131
|
+
|
|
132
|
+
<ParametersTable
|
|
133
|
+
type="ComposerPrimitiveAddAttachmentProps"
|
|
134
|
+
parameters={[
|
|
135
|
+
{
|
|
136
|
+
name: "multiple",
|
|
137
|
+
type: "boolean",
|
|
138
|
+
default: "true",
|
|
139
|
+
description: "Allow selecting multiple files at once.",
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: "asChild",
|
|
143
|
+
type: "boolean",
|
|
144
|
+
default: "false",
|
|
145
|
+
description: "Merge props with child element instead of rendering a wrapper button.",
|
|
146
|
+
},
|
|
147
|
+
]}
|
|
148
|
+
/>
|
|
149
|
+
|
|
150
|
+
This primitive renders a `<button>` element unless `asChild` is set.
|
|
151
|
+
|
|
152
|
+
### Message Attachments
|
|
153
|
+
|
|
154
|
+
#### MessagePrimitive.Attachments
|
|
155
|
+
|
|
156
|
+
Renders all attachments in a user message.
|
|
157
|
+
|
|
158
|
+
<ParametersTable
|
|
159
|
+
type="MessagePrimitiveAttachmentsProps"
|
|
160
|
+
parameters={[
|
|
161
|
+
{
|
|
162
|
+
name: "components",
|
|
163
|
+
type: "AttachmentComponents",
|
|
164
|
+
description: "Components to render for different attachment types (same as ComposerPrimitive.Attachments).",
|
|
165
|
+
},
|
|
166
|
+
]}
|
|
167
|
+
/>
|
|
168
|
+
|
|
169
|
+
### Attachment Primitives
|
|
170
|
+
|
|
171
|
+
#### AttachmentPrimitive.Root
|
|
172
|
+
|
|
173
|
+
Container for a single attachment.
|
|
174
|
+
|
|
175
|
+
<ParametersTable
|
|
176
|
+
type="AttachmentPrimitiveRootProps"
|
|
177
|
+
parameters={[
|
|
178
|
+
{
|
|
179
|
+
name: "asChild",
|
|
180
|
+
type: "boolean",
|
|
181
|
+
default: "false",
|
|
182
|
+
description: "Merge props with child element instead of rendering a wrapper div.",
|
|
183
|
+
},
|
|
184
|
+
]}
|
|
185
|
+
/>
|
|
186
|
+
|
|
187
|
+
#### AttachmentPrimitive.Name
|
|
188
|
+
|
|
189
|
+
Renders the attachment's file name.
|
|
190
|
+
|
|
191
|
+
#### AttachmentPrimitive.Remove
|
|
192
|
+
|
|
193
|
+
A button to remove the attachment from the composer.
|
|
194
|
+
|
|
195
|
+
<ParametersTable
|
|
196
|
+
type="AttachmentPrimitiveRemoveProps"
|
|
197
|
+
parameters={[
|
|
198
|
+
{
|
|
199
|
+
name: "asChild",
|
|
200
|
+
type: "boolean",
|
|
201
|
+
default: "false",
|
|
202
|
+
description: "Merge props with child element instead of rendering a wrapper button.",
|
|
203
|
+
},
|
|
204
|
+
]}
|
|
205
|
+
/>
|
|
206
|
+
|
|
207
|
+
### Attachment Types
|
|
208
|
+
|
|
209
|
+
Attachments have the following structure:
|
|
210
|
+
|
|
211
|
+
```typescript
|
|
212
|
+
type Attachment = {
|
|
213
|
+
id: string;
|
|
214
|
+
type: "image" | "document" | "file";
|
|
215
|
+
name: string;
|
|
216
|
+
contentType: string;
|
|
217
|
+
file?: File;
|
|
218
|
+
status:
|
|
219
|
+
| { type: "running" | "requires-action" | "incomplete"; progress?: number }
|
|
220
|
+
| { type: "complete" };
|
|
221
|
+
};
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Related Components
|
|
225
|
+
|
|
226
|
+
- [Thread](/docs/ui/thread) - Main chat interface that displays attachments
|
|
227
|
+
- [Attachments Guide](/docs/guides/attachments) - Complete setup instructions for attachment adapters
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Badge
|
|
3
|
+
description: A small label component for displaying status, categories, or metadata.
|
|
4
|
+
links:
|
|
5
|
+
- label: Radix UI Slot
|
|
6
|
+
url: https://www.radix-ui.com/primitives/docs/utilities/slot
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
10
|
+
import { ParametersTable } from "@/components/docs/tables/ParametersTable";
|
|
11
|
+
import { PreviewCode } from "@/components/docs/preview-code.server";
|
|
12
|
+
import {
|
|
13
|
+
BadgeSample,
|
|
14
|
+
BadgeSizesSample,
|
|
15
|
+
BadgeWithIconSample,
|
|
16
|
+
BadgeAsLinkSample,
|
|
17
|
+
BadgeAnimatedSample,
|
|
18
|
+
} from "@/components/docs/samples/badge";
|
|
19
|
+
|
|
20
|
+
<Callout>
|
|
21
|
+
This is a **standalone component** that does not depend on the assistant-ui runtime. Use it anywhere in your application.
|
|
22
|
+
</Callout>
|
|
23
|
+
|
|
24
|
+
<BadgeSample />
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
<InstallCommand shadcn={["badge"]} />
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { Badge } from "@/components/assistant-ui/badge";
|
|
34
|
+
|
|
35
|
+
export function Example() {
|
|
36
|
+
return <Badge>Label</Badge>;
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Examples
|
|
41
|
+
|
|
42
|
+
### Variants
|
|
43
|
+
|
|
44
|
+
Use the `variant` prop to change the visual style.
|
|
45
|
+
|
|
46
|
+
<BadgeSample />
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
<Badge variant="outline" /> // Border (default)
|
|
50
|
+
<Badge variant="secondary" /> // Secondary background
|
|
51
|
+
<Badge variant="muted" /> // Muted background
|
|
52
|
+
<Badge variant="ghost" /> // No background
|
|
53
|
+
<Badge variant="info" /> // Blue/info style
|
|
54
|
+
<Badge variant="warning" /> // Amber/warning style
|
|
55
|
+
<Badge variant="success" /> // Green/success style
|
|
56
|
+
<Badge variant="destructive" /> // Red/error style
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Sizes
|
|
60
|
+
|
|
61
|
+
Use the `size` prop to change the badge size.
|
|
62
|
+
|
|
63
|
+
<BadgeSizesSample />
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
<Badge size="sm" /> // Small
|
|
67
|
+
<Badge size="default" /> // Default
|
|
68
|
+
<Badge size="lg" /> // Large
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### With Icons
|
|
72
|
+
|
|
73
|
+
Badges automatically style SVG icons.
|
|
74
|
+
|
|
75
|
+
<PreviewCode file="components/docs/samples/badge" name="BadgeWithIconSample">
|
|
76
|
+
<BadgeWithIconSample />
|
|
77
|
+
</PreviewCode>
|
|
78
|
+
|
|
79
|
+
### As Link
|
|
80
|
+
|
|
81
|
+
Use the `asChild` prop to render the badge as a different element, like a link.
|
|
82
|
+
|
|
83
|
+
<PreviewCode file="components/docs/samples/badge" name="BadgeAsLinkSample">
|
|
84
|
+
<BadgeAsLinkSample />
|
|
85
|
+
</PreviewCode>
|
|
86
|
+
|
|
87
|
+
### Animated
|
|
88
|
+
|
|
89
|
+
Combine with CSS transitions for scroll and color animations.
|
|
90
|
+
|
|
91
|
+
<PreviewCode file="components/docs/samples/badge" name="BadgeAnimatedSample">
|
|
92
|
+
<BadgeAnimatedSample />
|
|
93
|
+
</PreviewCode>
|
|
94
|
+
|
|
95
|
+
## API Reference
|
|
96
|
+
|
|
97
|
+
### Badge
|
|
98
|
+
|
|
99
|
+
<ParametersTable
|
|
100
|
+
type="BadgeProps"
|
|
101
|
+
parameters={[
|
|
102
|
+
{
|
|
103
|
+
name: "variant",
|
|
104
|
+
type: '"outline" | "secondary" | "muted" | "ghost" | "info" | "warning" | "success" | "destructive"',
|
|
105
|
+
default: '"outline"',
|
|
106
|
+
description: "The visual style of the badge.",
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: "size",
|
|
110
|
+
type: '"sm" | "default" | "lg"',
|
|
111
|
+
default: '"default"',
|
|
112
|
+
description: "The size of the badge.",
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "asChild",
|
|
116
|
+
type: "boolean",
|
|
117
|
+
default: "false",
|
|
118
|
+
description: "Merge props with child element instead of rendering a span.",
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "className",
|
|
122
|
+
type: "string",
|
|
123
|
+
description: "Additional CSS classes.",
|
|
124
|
+
},
|
|
125
|
+
]}
|
|
126
|
+
/>
|
|
127
|
+
|
|
128
|
+
### Style Variants (CVA)
|
|
129
|
+
|
|
130
|
+
| Export | Description |
|
|
131
|
+
|--------|-------------|
|
|
132
|
+
| `badgeVariants` | Styles for the badge component. |
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
import { badgeVariants } from "@/components/assistant-ui/badge";
|
|
136
|
+
|
|
137
|
+
<span className={badgeVariants({ variant: "muted", size: "sm" })}>
|
|
138
|
+
Custom Badge
|
|
139
|
+
</span>
|
|
140
|
+
```
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: File
|
|
3
|
+
description: Display file message parts with icon, name, size, and download button.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
7
|
+
import { FileSample } from "@/components/docs/samples/file";
|
|
8
|
+
|
|
9
|
+
<FileSample />
|
|
10
|
+
|
|
11
|
+
## Getting Started
|
|
12
|
+
|
|
13
|
+
<Steps>
|
|
14
|
+
<Step>
|
|
15
|
+
|
|
16
|
+
### Add `file`
|
|
17
|
+
|
|
18
|
+
<InstallCommand shadcn={["file"]} />
|
|
19
|
+
|
|
20
|
+
</Step>
|
|
21
|
+
<Step>
|
|
22
|
+
|
|
23
|
+
### Use in your application
|
|
24
|
+
|
|
25
|
+
Pass `File` to `MessagePrimitive.Parts`:
|
|
26
|
+
|
|
27
|
+
```tsx title="/components/assistant-ui/thread.tsx" {1,8}
|
|
28
|
+
import { File } from "@/components/assistant-ui/file";
|
|
29
|
+
|
|
30
|
+
const AssistantMessage: FC = () => {
|
|
31
|
+
return (
|
|
32
|
+
<MessagePrimitive.Root className="...">
|
|
33
|
+
<MessagePrimitive.Parts
|
|
34
|
+
components={{
|
|
35
|
+
File,
|
|
36
|
+
}}
|
|
37
|
+
/>
|
|
38
|
+
</MessagePrimitive.Root>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
</Step>
|
|
44
|
+
</Steps>
|
|
45
|
+
|
|
46
|
+
## Variants
|
|
47
|
+
|
|
48
|
+
Use the `variant` prop to change the visual style.
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
<File.Root variant="outline" /> // Border (default)
|
|
52
|
+
<File.Root variant="ghost" /> // No border
|
|
53
|
+
<File.Root variant="muted" /> // Background fill
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Sizes
|
|
57
|
+
|
|
58
|
+
Use the `size` prop to change padding and font size.
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
<File.Root size="sm" /> // Compact
|
|
62
|
+
<File.Root size="default" /> // Default
|
|
63
|
+
<File.Root size="lg" /> // Larger
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## MimeType Icons
|
|
67
|
+
|
|
68
|
+
The component automatically selects an appropriate icon based on the file's MIME type:
|
|
69
|
+
|
|
70
|
+
| MIME Type | Icon |
|
|
71
|
+
|-----------|------|
|
|
72
|
+
| `image/*` | ImageIcon |
|
|
73
|
+
| `application/pdf` | FileTextIcon |
|
|
74
|
+
| `application/json` | BracesIcon |
|
|
75
|
+
| `text/*` | FileTextIcon |
|
|
76
|
+
| `audio/*` | MusicIcon |
|
|
77
|
+
| `video/*` | VideoIcon |
|
|
78
|
+
| fallback | FileIcon |
|
|
79
|
+
|
|
80
|
+
## API Reference
|
|
81
|
+
|
|
82
|
+
### Composable API
|
|
83
|
+
|
|
84
|
+
The component exports composable sub-components:
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
import {
|
|
88
|
+
File,
|
|
89
|
+
FileRoot,
|
|
90
|
+
FileIconDisplay,
|
|
91
|
+
FileName,
|
|
92
|
+
FileSize,
|
|
93
|
+
FileDownload,
|
|
94
|
+
} from "@/components/assistant-ui/file";
|
|
95
|
+
|
|
96
|
+
<FileRoot variant="muted" size="lg">
|
|
97
|
+
<FileIconDisplay mimeType="application/pdf" />
|
|
98
|
+
<div className="flex flex-col gap-0.5">
|
|
99
|
+
<FileName>report.pdf</FileName>
|
|
100
|
+
<FileSize bytes={2048} className="text-xs" />
|
|
101
|
+
</div>
|
|
102
|
+
<FileDownload
|
|
103
|
+
data="SGVsbG8gV29ybGQh"
|
|
104
|
+
mimeType="application/pdf"
|
|
105
|
+
filename="report.pdf"
|
|
106
|
+
/>
|
|
107
|
+
</FileRoot>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
| Component | Description |
|
|
111
|
+
|-----------|-------------|
|
|
112
|
+
| `File` | Default export, renders complete file part |
|
|
113
|
+
| `File.Root` | Container with variant and size styling |
|
|
114
|
+
| `File.Icon` | MIME type-aware icon, or pass custom `children` |
|
|
115
|
+
| `File.Name` | Truncated filename |
|
|
116
|
+
| `File.Size` | Human-readable file size |
|
|
117
|
+
| `File.Download` | Download link button |
|
|
118
|
+
|
|
119
|
+
### Custom Icon
|
|
120
|
+
|
|
121
|
+
Pass `children` to `File.Icon` to override the default MIME type icon:
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
<File.Icon>
|
|
125
|
+
<MyCustomIcon className="size-5" />
|
|
126
|
+
</File.Icon>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Utilities
|
|
130
|
+
|
|
131
|
+
The component also exports utility functions:
|
|
132
|
+
|
|
133
|
+
```tsx
|
|
134
|
+
import {
|
|
135
|
+
getMimeTypeIcon,
|
|
136
|
+
getBase64Size,
|
|
137
|
+
formatFileSize,
|
|
138
|
+
} from "@/components/assistant-ui/file";
|
|
139
|
+
|
|
140
|
+
// Get icon component for a MIME type
|
|
141
|
+
const Icon = getMimeTypeIcon("application/pdf"); // FileTextIcon
|
|
142
|
+
|
|
143
|
+
// Calculate size from base64 string
|
|
144
|
+
const bytes = getBase64Size("SGVsbG8gV29ybGQh"); // 12
|
|
145
|
+
|
|
146
|
+
// Format bytes to human-readable
|
|
147
|
+
const size = formatFileSize(2048); // "2.0 KB"
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Related Components
|
|
151
|
+
|
|
152
|
+
- [Image](/docs/ui/image) - Image message parts
|
|
153
|
+
- [Attachment](/docs/ui/attachment) - File attachments in composer and messages
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Image
|
|
3
|
+
description: Display image message parts with preview, loading states, and fullscreen dialog.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
7
|
+
import { ImageSample } from "@/components/docs/samples/image";
|
|
8
|
+
|
|
9
|
+
<ImageSample />
|
|
10
|
+
|
|
11
|
+
## Getting Started
|
|
12
|
+
|
|
13
|
+
<Steps>
|
|
14
|
+
<Step>
|
|
15
|
+
|
|
16
|
+
### Add `image`
|
|
17
|
+
|
|
18
|
+
<InstallCommand shadcn={["image"]} />
|
|
19
|
+
|
|
20
|
+
</Step>
|
|
21
|
+
<Step>
|
|
22
|
+
|
|
23
|
+
### Use in your application
|
|
24
|
+
|
|
25
|
+
Pass `Image` to `MessagePrimitive.Parts`:
|
|
26
|
+
|
|
27
|
+
```tsx title="/components/assistant-ui/thread.tsx" {1,8}
|
|
28
|
+
import { Image } from "@/components/assistant-ui/image";
|
|
29
|
+
|
|
30
|
+
const AssistantMessage: FC = () => {
|
|
31
|
+
return (
|
|
32
|
+
<MessagePrimitive.Root className="...">
|
|
33
|
+
<MessagePrimitive.Parts
|
|
34
|
+
components={{
|
|
35
|
+
Image,
|
|
36
|
+
}}
|
|
37
|
+
/>
|
|
38
|
+
</MessagePrimitive.Root>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
</Step>
|
|
44
|
+
</Steps>
|
|
45
|
+
|
|
46
|
+
## Variants
|
|
47
|
+
|
|
48
|
+
Use the `variant` prop to change the visual style.
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
<Image.Root variant="outline" /> // Border (default)
|
|
52
|
+
<Image.Root variant="ghost" /> // No border
|
|
53
|
+
<Image.Root variant="muted" /> // Background fill
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Sizes
|
|
57
|
+
|
|
58
|
+
Use the `size` prop to control the maximum width.
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
<Image.Root size="sm" /> // max-w-64 (256px)
|
|
62
|
+
<Image.Root size="default" /> // max-w-96 (384px)
|
|
63
|
+
<Image.Root size="lg" /> // max-w-[512px]
|
|
64
|
+
<Image.Root size="full" /> // w-full
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## API Reference
|
|
68
|
+
|
|
69
|
+
### Composable API
|
|
70
|
+
|
|
71
|
+
The component exports composable sub-components:
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import {
|
|
75
|
+
Image,
|
|
76
|
+
ImageRoot,
|
|
77
|
+
ImagePreview,
|
|
78
|
+
ImageFilename,
|
|
79
|
+
ImageZoom,
|
|
80
|
+
} from "@/components/assistant-ui/image";
|
|
81
|
+
|
|
82
|
+
<ImageRoot variant="muted" size="lg">
|
|
83
|
+
<ImageZoom src="https://example.com/photo.jpg" alt="Photo">
|
|
84
|
+
<ImagePreview src="https://example.com/photo.jpg" alt="Photo" />
|
|
85
|
+
</ImageZoom>
|
|
86
|
+
<ImageFilename>photo.jpg</ImageFilename>
|
|
87
|
+
</ImageRoot>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
| Component | Description |
|
|
91
|
+
|-----------|-------------|
|
|
92
|
+
| `Image` | Default export, renders complete image part |
|
|
93
|
+
| `Image.Root` | Container with variant and size styling |
|
|
94
|
+
| `Image.Preview` | Image container with loading/error states |
|
|
95
|
+
| `Image.Filename` | Optional filename display below image |
|
|
96
|
+
| `Image.Zoom` | Medium-style zoom overlay (click to expand, ESC to close) |
|
|
97
|
+
|
|
98
|
+
## Related Components
|
|
99
|
+
|
|
100
|
+
- [Attachment](/docs/ui/attachment) - File attachments in composer and messages
|
|
101
|
+
- [File](/docs/ui/file) - Non-image file message parts
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Markdown
|
|
3
|
+
description: Display rich text with headings, lists, links, and code blocks.
|
|
3
4
|
---
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
7
|
+
import { MarkdownSample } from "@/components/docs/samples/markdown";
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
import { Callout } from "fumadocs-ui/components/callout";
|
|
9
|
-
import { InstallCommand } from "@/components/docs/install-command";
|
|
9
|
+
<MarkdownSample />
|
|
10
10
|
|
|
11
11
|
<Callout>
|
|
12
12
|
Markdown support is already included by default in the `Thread` component.
|
|
@@ -31,7 +31,7 @@ This adds a `/components/assistant-ui/markdown-text.tsx` file to your project, w
|
|
|
31
31
|
|
|
32
32
|
Pass the `MarkdownText` component to the `MessagePrimitive.Parts` component
|
|
33
33
|
|
|
34
|
-
```tsx twoslash title="/components/assistant-ui/thread.tsx" {1,
|
|
34
|
+
```tsx twoslash title="/components/assistant-ui/thread.tsx" {1,7}
|
|
35
35
|
// @filename: /components/assistant-ui/markdown-text.tsx
|
|
36
36
|
import { FC } from "react";
|
|
37
37
|
export const MarkdownText: FC = () => null;
|
|
@@ -67,4 +67,9 @@ const AssistantMessage: FC = () => {
|
|
|
67
67
|
|
|
68
68
|
## Syntax highlighting
|
|
69
69
|
|
|
70
|
-
Syntax Highlighting is not included by default, see [Syntax Highlighting](/docs/ui/
|
|
70
|
+
Syntax Highlighting is not included by default, see [Syntax Highlighting](/docs/ui/syntax-highlighting) to learn how to add it.
|
|
71
|
+
|
|
72
|
+
## Related Components
|
|
73
|
+
|
|
74
|
+
- [Syntax Highlighting](/docs/ui/syntax-highlighting) - Add code highlighting to markdown
|
|
75
|
+
- [Mermaid](/docs/ui/mermaid) - Render diagrams in markdown code blocks
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Mermaid Diagrams"
|
|
3
|
+
description: Render Mermaid diagrams in chat messages with streaming support.
|
|
3
4
|
---
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { InstallCommand } from "@/components/docs/install-command";
|
|
6
|
+
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
7
|
+
import { MermaidSample } from "@/components/docs/samples/mermaid";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
<MermaidSample />
|
|
10
|
+
|
|
11
|
+
## Getting Started
|
|
10
12
|
|
|
11
13
|
<Steps>
|
|
12
14
|
<Step>
|
|
@@ -67,7 +69,7 @@ The `MermaidDiagram` component is optimized for streaming scenarios:
|
|
|
67
69
|
Mermaid supports various diagram types including:
|
|
68
70
|
|
|
69
71
|
- Flowcharts and decision trees
|
|
70
|
-
- Sequence diagrams
|
|
72
|
+
- Sequence diagrams
|
|
71
73
|
- Gantt charts
|
|
72
74
|
- Class diagrams
|
|
73
75
|
- State diagrams
|
|
@@ -76,3 +78,8 @@ Mermaid supports various diagram types including:
|
|
|
76
78
|
- Entity relationship diagrams
|
|
77
79
|
|
|
78
80
|
See the [Mermaid documentation](https://mermaid.js.org/) for complete syntax reference.
|
|
81
|
+
|
|
82
|
+
## Related Components
|
|
83
|
+
|
|
84
|
+
- [Markdown](/docs/ui/markdown) - Rich text rendering where mermaid is integrated
|
|
85
|
+
- [Syntax Highlighting](/docs/ui/syntax-highlighting) - Code highlighting for other languages
|