@assistant-ui/mcp-docs-server 0.1.19 → 0.1.21
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 +172 -1633
- package/.docs/organized/code-examples/with-ai-sdk-v6.md +42 -1640
- package/.docs/organized/code-examples/with-assistant-transport.md +40 -1743
- package/.docs/organized/code-examples/with-cloud.md +71 -1745
- package/.docs/organized/code-examples/with-custom-thread-list.md +87 -1723
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +70 -1637
- package/.docs/organized/code-examples/with-external-store.md +67 -1624
- package/.docs/organized/code-examples/with-ffmpeg.md +71 -1629
- package/.docs/organized/code-examples/with-langgraph.md +95 -1893
- package/.docs/organized/code-examples/with-parent-id-grouping.md +57 -1654
- package/.docs/organized/code-examples/with-react-hook-form.md +220 -2163
- package/.docs/organized/code-examples/with-react-router.md +66 -1318
- package/.docs/organized/code-examples/with-store.md +31 -31
- package/.docs/organized/code-examples/with-tanstack.md +77 -861
- package/.docs/organized/code-examples/with-tap-runtime.md +812 -0
- package/.docs/raw/docs/(docs)/cli.mdx +66 -0
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +0 -1
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +0 -1
- package/.docs/raw/docs/(docs)/copilots/model-context.mdx +4 -4
- package/.docs/raw/docs/(docs)/copilots/motivation.mdx +3 -3
- package/.docs/raw/docs/(docs)/devtools.mdx +0 -1
- package/.docs/raw/docs/(docs)/guides/attachments.mdx +2 -3
- package/.docs/raw/docs/(docs)/guides/context-api.mdx +117 -117
- package/.docs/raw/docs/(docs)/guides/suggestions.mdx +296 -0
- package/.docs/raw/docs/(docs)/guides/tools.mdx +336 -513
- package/.docs/raw/docs/(docs)/index.mdx +33 -410
- package/.docs/raw/docs/(docs)/installation.mdx +450 -0
- package/.docs/raw/docs/(docs)/llm.mdx +209 -0
- package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +48 -3
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-hook-form.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/integrations/vercel-ai-sdk.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/overview.mdx +9 -3
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +20 -52
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +16 -39
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +49 -50
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +3 -11
- package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +0 -3
- package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +5 -16
- package/.docs/raw/docs/(reference)/api-reference/primitives/composition.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/error.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +1 -2
- package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +152 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item-more.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +1 -2
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +1 -2
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +28 -40
- package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +1 -2
- package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +2 -3
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +1 -2
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +1 -2
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +1 -2
- package/.docs/raw/docs/(reference)/legacy/styled/assistant-modal.mdx +0 -1
- package/.docs/raw/docs/(reference)/legacy/styled/decomposition.mdx +5 -5
- package/.docs/raw/docs/(reference)/legacy/styled/markdown.mdx +0 -1
- package/.docs/raw/docs/(reference)/legacy/styled/thread.mdx +0 -1
- package/.docs/raw/docs/(reference)/migrations/v0-12.mdx +207 -33
- package/.docs/raw/docs/(reference)/react-compatibility.mdx +0 -1
- package/.docs/raw/docs/cloud/persistence/ai-sdk.mdx +0 -1
- package/.docs/raw/docs/cloud/persistence/langgraph.mdx +0 -1
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +0 -1
- package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +118 -0
- package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +198 -0
- package/.docs/raw/docs/runtimes/assistant-transport.mdx +3 -3
- package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +5 -6
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +9 -11
- package/.docs/raw/docs/runtimes/custom/local.mdx +43 -36
- package/.docs/raw/docs/runtimes/data-stream.mdx +35 -3
- package/.docs/raw/docs/runtimes/langgraph/index.mdx +1 -2
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +0 -1
- package/.docs/raw/docs/runtimes/langserve.mdx +0 -1
- package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +0 -1
- package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +0 -1
- package/.docs/raw/docs/ui/accordion.mdx +259 -0
- package/.docs/raw/docs/ui/assistant-modal.mdx +1 -3
- package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -3
- package/.docs/raw/docs/ui/attachment.mdx +0 -2
- package/.docs/raw/docs/ui/badge.mdx +138 -0
- package/.docs/raw/docs/ui/diff-viewer.mdx +279 -0
- package/.docs/raw/docs/ui/file.mdx +152 -0
- package/.docs/raw/docs/ui/image.mdx +100 -0
- package/.docs/raw/docs/ui/markdown.mdx +0 -1
- package/.docs/raw/docs/ui/mermaid.mdx +0 -1
- package/.docs/raw/docs/ui/model-selector.mdx +224 -0
- package/.docs/raw/docs/ui/part-grouping.mdx +4 -5
- package/.docs/raw/docs/ui/reasoning.mdx +6 -5
- package/.docs/raw/docs/ui/scrollbar.mdx +26 -9
- package/.docs/raw/docs/ui/select.mdx +245 -0
- package/.docs/raw/docs/ui/sources.mdx +6 -5
- package/.docs/raw/docs/ui/streamdown.mdx +348 -0
- package/.docs/raw/docs/ui/syntax-highlighting.mdx +8 -63
- package/.docs/raw/docs/ui/tabs.mdx +259 -0
- package/.docs/raw/docs/ui/thread-list.mdx +98 -16
- package/.docs/raw/docs/ui/thread.mdx +57 -73
- package/.docs/raw/docs/ui/tool-fallback.mdx +0 -1
- package/.docs/raw/docs/ui/tool-group.mdx +1 -3
- package/README.md +3 -3
- package/package.json +4 -4
- package/src/tools/tests/examples.test.ts +1 -1
- package/.docs/raw/docs/(docs)/about-assistantui.mdx +0 -54
- package/.docs/raw/docs/(docs)/mcp-docs-server.mdx +0 -321
- package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +0 -219
|
@@ -0,0 +1,138 @@
|
|
|
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 { PreviewCode } from "@/components/docs/preview-code.server";
|
|
10
|
+
import {
|
|
11
|
+
BadgeSample,
|
|
12
|
+
BadgeSizesSample,
|
|
13
|
+
BadgeWithIconSample,
|
|
14
|
+
BadgeAsLinkSample,
|
|
15
|
+
BadgeAnimatedSample,
|
|
16
|
+
} from "@/components/docs/samples/badge";
|
|
17
|
+
|
|
18
|
+
<Callout>
|
|
19
|
+
This is a **standalone component** that does not depend on the assistant-ui runtime. Use it anywhere in your application.
|
|
20
|
+
</Callout>
|
|
21
|
+
|
|
22
|
+
<BadgeSample />
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
<InstallCommand shadcn={["badge"]} />
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { Badge } from "@/components/assistant-ui/badge";
|
|
32
|
+
|
|
33
|
+
export function Example() {
|
|
34
|
+
return <Badge>Label</Badge>;
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Examples
|
|
39
|
+
|
|
40
|
+
### Variants
|
|
41
|
+
|
|
42
|
+
Use the `variant` prop to change the visual style.
|
|
43
|
+
|
|
44
|
+
<BadgeSample />
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
<Badge variant="outline" /> // Border (default)
|
|
48
|
+
<Badge variant="secondary" /> // Secondary background
|
|
49
|
+
<Badge variant="muted" /> // Muted background
|
|
50
|
+
<Badge variant="ghost" /> // No background
|
|
51
|
+
<Badge variant="info" /> // Blue/info style
|
|
52
|
+
<Badge variant="warning" /> // Amber/warning style
|
|
53
|
+
<Badge variant="success" /> // Green/success style
|
|
54
|
+
<Badge variant="destructive" /> // Red/error style
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Sizes
|
|
58
|
+
|
|
59
|
+
Use the `size` prop to change the badge size.
|
|
60
|
+
|
|
61
|
+
<BadgeSizesSample />
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
<Badge size="sm" /> // Small
|
|
65
|
+
<Badge size="default" /> // Default
|
|
66
|
+
<Badge size="lg" /> // Large
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### With Icons
|
|
70
|
+
|
|
71
|
+
Badges automatically style SVG icons.
|
|
72
|
+
|
|
73
|
+
<PreviewCode file="components/docs/samples/badge" name="BadgeWithIconSample">
|
|
74
|
+
<BadgeWithIconSample />
|
|
75
|
+
</PreviewCode>
|
|
76
|
+
|
|
77
|
+
### As Link
|
|
78
|
+
|
|
79
|
+
Use the `asChild` prop to render the badge as a different element, like a link.
|
|
80
|
+
|
|
81
|
+
<PreviewCode file="components/docs/samples/badge" name="BadgeAsLinkSample">
|
|
82
|
+
<BadgeAsLinkSample />
|
|
83
|
+
</PreviewCode>
|
|
84
|
+
|
|
85
|
+
### Animated
|
|
86
|
+
|
|
87
|
+
Combine with CSS transitions for scroll and color animations.
|
|
88
|
+
|
|
89
|
+
<PreviewCode file="components/docs/samples/badge" name="BadgeAnimatedSample">
|
|
90
|
+
<BadgeAnimatedSample />
|
|
91
|
+
</PreviewCode>
|
|
92
|
+
|
|
93
|
+
## API Reference
|
|
94
|
+
|
|
95
|
+
### Badge
|
|
96
|
+
|
|
97
|
+
<ParametersTable
|
|
98
|
+
type="BadgeProps"
|
|
99
|
+
parameters={[
|
|
100
|
+
{
|
|
101
|
+
name: "variant",
|
|
102
|
+
type: '"outline" | "secondary" | "muted" | "ghost" | "info" | "warning" | "success" | "destructive"',
|
|
103
|
+
default: '"outline"',
|
|
104
|
+
description: "The visual style of the badge.",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "size",
|
|
108
|
+
type: '"sm" | "default" | "lg"',
|
|
109
|
+
default: '"default"',
|
|
110
|
+
description: "The size of the badge.",
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "asChild",
|
|
114
|
+
type: "boolean",
|
|
115
|
+
default: "false",
|
|
116
|
+
description: "Merge props with child element instead of rendering a span.",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "className",
|
|
120
|
+
type: "string",
|
|
121
|
+
description: "Additional CSS classes.",
|
|
122
|
+
},
|
|
123
|
+
]}
|
|
124
|
+
/>
|
|
125
|
+
|
|
126
|
+
### Style Variants (CVA)
|
|
127
|
+
|
|
128
|
+
| Export | Description |
|
|
129
|
+
|--------|-------------|
|
|
130
|
+
| `badgeVariants` | Styles for the badge component. |
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
import { badgeVariants } from "@/components/assistant-ui/badge";
|
|
134
|
+
|
|
135
|
+
<span className={badgeVariants({ variant: "muted", size: "sm" })}>
|
|
136
|
+
Custom Badge
|
|
137
|
+
</span>
|
|
138
|
+
```
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Diff Viewer"
|
|
3
|
+
description: Render code diffs with syntax highlighting for additions and deletions.
|
|
4
|
+
links:
|
|
5
|
+
- label: parse-diff
|
|
6
|
+
url: https://github.com/sergeyt/parse-diff
|
|
7
|
+
- label: diff
|
|
8
|
+
url: https://github.com/kpdecker/jsdiff
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
import { PreviewCode } from "@/components/docs/preview-code.server";
|
|
12
|
+
import {
|
|
13
|
+
DiffViewerSample,
|
|
14
|
+
DiffViewerSplitSample,
|
|
15
|
+
DiffViewerViewModesSample,
|
|
16
|
+
DiffViewerVariantsSample,
|
|
17
|
+
DiffViewerSizesSample,
|
|
18
|
+
} from "@/components/docs/samples/diff-viewer";
|
|
19
|
+
|
|
20
|
+
<Callout>
|
|
21
|
+
This is a **standalone component** that does not depend on the assistant-ui runtime.
|
|
22
|
+
</Callout>
|
|
23
|
+
|
|
24
|
+
<DiffViewerViewModesSample />
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
<InstallCommand shadcn={["diff-viewer"]} />
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { DiffViewer } from "@/components/assistant-ui/diff-viewer";
|
|
34
|
+
|
|
35
|
+
// With a unified diff patch
|
|
36
|
+
<DiffViewer patch={diffString} />
|
|
37
|
+
|
|
38
|
+
// With file comparison
|
|
39
|
+
<DiffViewer
|
|
40
|
+
oldFile={{ content: "old content", name: "file.txt" }}
|
|
41
|
+
newFile={{ content: "new content", name: "file.txt" }}
|
|
42
|
+
/>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### As Markdown Language Override
|
|
46
|
+
|
|
47
|
+
Integrate with `MarkdownTextPrimitive` to render diff code blocks:
|
|
48
|
+
|
|
49
|
+
```tsx title="/components/assistant-ui/markdown-text.tsx"
|
|
50
|
+
import { DiffViewer } from "@/components/assistant-ui/diff-viewer"; // [!code ++]
|
|
51
|
+
|
|
52
|
+
const MarkdownTextImpl = () => {
|
|
53
|
+
return (
|
|
54
|
+
<MarkdownTextPrimitive
|
|
55
|
+
remarkPlugins={[remarkGfm]}
|
|
56
|
+
className="aui-md"
|
|
57
|
+
components={defaultComponents}
|
|
58
|
+
componentsByLanguage={{ // [!code ++]
|
|
59
|
+
diff: { // [!code ++]
|
|
60
|
+
SyntaxHighlighter: ({ code }) => <DiffViewer patch={code} /> // [!code ++]
|
|
61
|
+
}, // [!code ++]
|
|
62
|
+
}} // [!code ++]
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const MarkdownText = memo(MarkdownTextImpl);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Examples
|
|
71
|
+
|
|
72
|
+
### Unified View
|
|
73
|
+
|
|
74
|
+
Shows all changes in a single column with `+`/`-` indicators. This is the default mode.
|
|
75
|
+
|
|
76
|
+
<DiffViewerSample />
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
<DiffViewer patch={diffString} viewMode="unified" />
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Split View
|
|
83
|
+
|
|
84
|
+
Shows old content on the left, new content on the right side-by-side.
|
|
85
|
+
|
|
86
|
+
<DiffViewerSplitSample />
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
<DiffViewer patch={diffString} viewMode="split" />
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Interactive Mode Toggle
|
|
93
|
+
|
|
94
|
+
<PreviewCode file="components/docs/samples/diff-viewer" name="DiffViewerViewModesSample">
|
|
95
|
+
<DiffViewerViewModesSample />
|
|
96
|
+
</PreviewCode>
|
|
97
|
+
|
|
98
|
+
### Variants
|
|
99
|
+
|
|
100
|
+
<DiffViewerVariantsSample />
|
|
101
|
+
|
|
102
|
+
### Sizes
|
|
103
|
+
|
|
104
|
+
<DiffViewerSizesSample />
|
|
105
|
+
|
|
106
|
+
### Theming
|
|
107
|
+
|
|
108
|
+
DiffViewer uses CSS variables for colors. Override them in your CSS:
|
|
109
|
+
|
|
110
|
+
```css
|
|
111
|
+
[data-slot="diff-viewer"] {
|
|
112
|
+
--diff-add-bg: rgba(46, 160, 67, 0.15);
|
|
113
|
+
--diff-add-text: #1a7f37;
|
|
114
|
+
--diff-add-text-dark: #3fb950;
|
|
115
|
+
--diff-del-bg: rgba(248, 81, 73, 0.15);
|
|
116
|
+
--diff-del-text: #cf222e;
|
|
117
|
+
--diff-del-text-dark: #f85149;
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
| Variable | Description |
|
|
122
|
+
|----------|-------------|
|
|
123
|
+
| `--diff-add-bg` | Background for added lines |
|
|
124
|
+
| `--diff-add-text` | Text color for added lines (light mode) |
|
|
125
|
+
| `--diff-add-text-dark` | Text color for added lines (dark mode) |
|
|
126
|
+
| `--diff-del-bg` | Background for deleted lines |
|
|
127
|
+
| `--diff-del-text` | Text color for deleted lines (light mode) |
|
|
128
|
+
| `--diff-del-text-dark` | Text color for deleted lines (dark mode) |
|
|
129
|
+
|
|
130
|
+
## API Reference
|
|
131
|
+
|
|
132
|
+
### DiffViewer
|
|
133
|
+
|
|
134
|
+
The main component for rendering diffs.
|
|
135
|
+
|
|
136
|
+
<ParametersTable
|
|
137
|
+
type="DiffViewerProps"
|
|
138
|
+
parameters={[
|
|
139
|
+
{
|
|
140
|
+
name: "patch",
|
|
141
|
+
type: "string",
|
|
142
|
+
description: "Unified diff string (e.g., output from git diff).",
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: "code",
|
|
146
|
+
type: "string",
|
|
147
|
+
description: "Alias for patch (for markdown integration).",
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: "oldFile",
|
|
151
|
+
type: "{ content: string; name?: string }",
|
|
152
|
+
description: "Old file for direct comparison.",
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: "newFile",
|
|
156
|
+
type: "{ content: string; name?: string }",
|
|
157
|
+
description: "New file for direct comparison.",
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: "viewMode",
|
|
161
|
+
type: '"unified" | "split"',
|
|
162
|
+
default: '"unified"',
|
|
163
|
+
description: "Display mode for the diff.",
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: "variant",
|
|
167
|
+
type: '"default" | "ghost" | "muted"',
|
|
168
|
+
default: '"default"',
|
|
169
|
+
description: "Visual style variant.",
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: "size",
|
|
173
|
+
type: '"sm" | "default" | "lg"',
|
|
174
|
+
default: '"default"',
|
|
175
|
+
description: "Font size.",
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: "showLineNumbers",
|
|
179
|
+
type: "boolean",
|
|
180
|
+
default: "true",
|
|
181
|
+
description: "Show line numbers.",
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: "showIcon",
|
|
185
|
+
type: "boolean",
|
|
186
|
+
default: "true",
|
|
187
|
+
description: "Show file extension badge in header.",
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: "showStats",
|
|
191
|
+
type: "boolean",
|
|
192
|
+
default: "true",
|
|
193
|
+
description: "Show addition/deletion counts in header.",
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: "className",
|
|
197
|
+
type: "string",
|
|
198
|
+
description: "Additional CSS classes.",
|
|
199
|
+
},
|
|
200
|
+
]}
|
|
201
|
+
/>
|
|
202
|
+
|
|
203
|
+
### Composable API
|
|
204
|
+
|
|
205
|
+
| Component | Description |
|
|
206
|
+
|-----------|-------------|
|
|
207
|
+
| `DiffViewer` | Main component that renders the diff. |
|
|
208
|
+
| `DiffViewerFile` | Wrapper for each file in multi-file diffs. |
|
|
209
|
+
| `DiffViewerHeader` | File name header with icon and stats. |
|
|
210
|
+
| `DiffViewerContent` | Scrollable content area. |
|
|
211
|
+
| `DiffViewerLine` | Individual line in unified mode. |
|
|
212
|
+
| `DiffViewerSplitLine` | Side-by-side line pair in split mode. |
|
|
213
|
+
| `DiffViewerFileBadge` | File extension badge (e.g., "TS"). |
|
|
214
|
+
| `DiffViewerStats` | Addition/deletion count display. |
|
|
215
|
+
|
|
216
|
+
### Style Variants (CVA)
|
|
217
|
+
|
|
218
|
+
| Export | Description |
|
|
219
|
+
|--------|-------------|
|
|
220
|
+
| `diffViewerVariants` | Styles for the root container. |
|
|
221
|
+
| `diffLineVariants` | Background styles for diff lines. |
|
|
222
|
+
| `diffLineTextVariants` | Text color styles for diff lines. |
|
|
223
|
+
|
|
224
|
+
```tsx
|
|
225
|
+
import {
|
|
226
|
+
diffViewerVariants,
|
|
227
|
+
diffLineVariants,
|
|
228
|
+
diffLineTextVariants,
|
|
229
|
+
} from "@/components/assistant-ui/diff-viewer";
|
|
230
|
+
|
|
231
|
+
// Use variants directly
|
|
232
|
+
<div className={diffViewerVariants({ variant: "ghost", size: "sm" })}>
|
|
233
|
+
Custom diff container
|
|
234
|
+
</div>
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Utilities
|
|
238
|
+
|
|
239
|
+
| Export | Description |
|
|
240
|
+
|--------|-------------|
|
|
241
|
+
| `parsePatch(patch)` | Parse unified diff string into structured data. |
|
|
242
|
+
| `computeDiff(old, new)` | Compute diff between two strings. |
|
|
243
|
+
| `ParsedLine` | Type for a single diff line. |
|
|
244
|
+
| `ParsedFile` | Type for a parsed file with lines and stats. |
|
|
245
|
+
| `SplitLinePair` | Type for a side-by-side line pair. |
|
|
246
|
+
|
|
247
|
+
## Styling
|
|
248
|
+
|
|
249
|
+
### Data Attributes
|
|
250
|
+
|
|
251
|
+
Use data attributes for custom styling:
|
|
252
|
+
|
|
253
|
+
| Attribute | Values | Description |
|
|
254
|
+
|-----------|--------|-------------|
|
|
255
|
+
| `data-slot` | `"diff-viewer"`, `"diff-viewer-header"`, `"diff-viewer-line"`, etc. | Component identification |
|
|
256
|
+
| `data-type` | `"add"`, `"del"`, `"normal"`, `"empty"` | Line type |
|
|
257
|
+
| `data-view-mode` | `"unified"`, `"split"` | Current view mode |
|
|
258
|
+
| `data-variant` | `"default"`, `"ghost"`, `"muted"` | Current variant |
|
|
259
|
+
|
|
260
|
+
### Custom CSS Example
|
|
261
|
+
|
|
262
|
+
```css
|
|
263
|
+
[data-slot="diff-viewer"][data-view-mode="split"] {
|
|
264
|
+
/* Custom split view styles */
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
[data-slot="diff-viewer-line"][data-type="add"] {
|
|
268
|
+
/* Custom addition styles */
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
[data-slot="diff-viewer-line"][data-type="del"] {
|
|
272
|
+
/* Custom deletion styles */
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Related Components
|
|
277
|
+
|
|
278
|
+
- [Markdown](/docs/ui/markdown) - Rich text rendering where diff viewer can be integrated
|
|
279
|
+
- [Syntax Highlighting](/docs/ui/syntax-highlighting) - Code highlighting for other languages
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: File
|
|
3
|
+
description: Display file message parts with icon, name, size, and download button.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { FileSample } from "@/components/docs/samples/file";
|
|
7
|
+
|
|
8
|
+
<FileSample />
|
|
9
|
+
|
|
10
|
+
## Getting Started
|
|
11
|
+
|
|
12
|
+
<Steps>
|
|
13
|
+
<Step>
|
|
14
|
+
|
|
15
|
+
### Add `file`
|
|
16
|
+
|
|
17
|
+
<InstallCommand shadcn={["file"]} />
|
|
18
|
+
|
|
19
|
+
</Step>
|
|
20
|
+
<Step>
|
|
21
|
+
|
|
22
|
+
### Use in your application
|
|
23
|
+
|
|
24
|
+
Pass `File` to `MessagePrimitive.Parts`:
|
|
25
|
+
|
|
26
|
+
```tsx title="/components/assistant-ui/thread.tsx" {1,8}
|
|
27
|
+
import { File } from "@/components/assistant-ui/file";
|
|
28
|
+
|
|
29
|
+
const AssistantMessage: FC = () => {
|
|
30
|
+
return (
|
|
31
|
+
<MessagePrimitive.Root className="...">
|
|
32
|
+
<MessagePrimitive.Parts
|
|
33
|
+
components={{
|
|
34
|
+
File,
|
|
35
|
+
}}
|
|
36
|
+
/>
|
|
37
|
+
</MessagePrimitive.Root>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
</Step>
|
|
43
|
+
</Steps>
|
|
44
|
+
|
|
45
|
+
## Variants
|
|
46
|
+
|
|
47
|
+
Use the `variant` prop to change the visual style.
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
<File.Root variant="outline" /> // Border (default)
|
|
51
|
+
<File.Root variant="ghost" /> // No border
|
|
52
|
+
<File.Root variant="muted" /> // Background fill
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Sizes
|
|
56
|
+
|
|
57
|
+
Use the `size` prop to change padding and font size.
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
<File.Root size="sm" /> // Compact
|
|
61
|
+
<File.Root size="default" /> // Default
|
|
62
|
+
<File.Root size="lg" /> // Larger
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## MimeType Icons
|
|
66
|
+
|
|
67
|
+
The component automatically selects an appropriate icon based on the file's MIME type:
|
|
68
|
+
|
|
69
|
+
| MIME Type | Icon |
|
|
70
|
+
|-----------|------|
|
|
71
|
+
| `image/*` | ImageIcon |
|
|
72
|
+
| `application/pdf` | FileTextIcon |
|
|
73
|
+
| `application/json` | BracesIcon |
|
|
74
|
+
| `text/*` | FileTextIcon |
|
|
75
|
+
| `audio/*` | MusicIcon |
|
|
76
|
+
| `video/*` | VideoIcon |
|
|
77
|
+
| fallback | FileIcon |
|
|
78
|
+
|
|
79
|
+
## API Reference
|
|
80
|
+
|
|
81
|
+
### Composable API
|
|
82
|
+
|
|
83
|
+
The component exports composable sub-components:
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
import {
|
|
87
|
+
File,
|
|
88
|
+
FileRoot,
|
|
89
|
+
FileIconDisplay,
|
|
90
|
+
FileName,
|
|
91
|
+
FileSize,
|
|
92
|
+
FileDownload,
|
|
93
|
+
} from "@/components/assistant-ui/file";
|
|
94
|
+
|
|
95
|
+
<FileRoot variant="muted" size="lg">
|
|
96
|
+
<FileIconDisplay mimeType="application/pdf" />
|
|
97
|
+
<div className="flex flex-col gap-0.5">
|
|
98
|
+
<FileName>report.pdf</FileName>
|
|
99
|
+
<FileSize bytes={2048} className="text-xs" />
|
|
100
|
+
</div>
|
|
101
|
+
<FileDownload
|
|
102
|
+
data="SGVsbG8gV29ybGQh"
|
|
103
|
+
mimeType="application/pdf"
|
|
104
|
+
filename="report.pdf"
|
|
105
|
+
/>
|
|
106
|
+
</FileRoot>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
| Component | Description |
|
|
110
|
+
|-----------|-------------|
|
|
111
|
+
| `File` | Default export, renders complete file part |
|
|
112
|
+
| `File.Root` | Container with variant and size styling |
|
|
113
|
+
| `File.Icon` | MIME type-aware icon, or pass custom `children` |
|
|
114
|
+
| `File.Name` | Truncated filename |
|
|
115
|
+
| `File.Size` | Human-readable file size |
|
|
116
|
+
| `File.Download` | Download link button |
|
|
117
|
+
|
|
118
|
+
### Custom Icon
|
|
119
|
+
|
|
120
|
+
Pass `children` to `File.Icon` to override the default MIME type icon:
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
<File.Icon>
|
|
124
|
+
<MyCustomIcon className="size-5" />
|
|
125
|
+
</File.Icon>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Utilities
|
|
129
|
+
|
|
130
|
+
The component also exports utility functions:
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
import {
|
|
134
|
+
getMimeTypeIcon,
|
|
135
|
+
getBase64Size,
|
|
136
|
+
formatFileSize,
|
|
137
|
+
} from "@/components/assistant-ui/file";
|
|
138
|
+
|
|
139
|
+
// Get icon component for a MIME type
|
|
140
|
+
const Icon = getMimeTypeIcon("application/pdf"); // FileTextIcon
|
|
141
|
+
|
|
142
|
+
// Calculate size from base64 string
|
|
143
|
+
const bytes = getBase64Size("SGVsbG8gV29ybGQh"); // 12
|
|
144
|
+
|
|
145
|
+
// Format bytes to human-readable
|
|
146
|
+
const size = formatFileSize(2048); // "2.0 KB"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Related Components
|
|
150
|
+
|
|
151
|
+
- [Image](/docs/ui/image) - Image message parts
|
|
152
|
+
- [Attachment](/docs/ui/attachment) - File attachments in composer and messages
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Image
|
|
3
|
+
description: Display image message parts with preview, loading states, and fullscreen dialog.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { ImageSample } from "@/components/docs/samples/image";
|
|
7
|
+
|
|
8
|
+
<ImageSample />
|
|
9
|
+
|
|
10
|
+
## Getting Started
|
|
11
|
+
|
|
12
|
+
<Steps>
|
|
13
|
+
<Step>
|
|
14
|
+
|
|
15
|
+
### Add `image`
|
|
16
|
+
|
|
17
|
+
<InstallCommand shadcn={["image"]} />
|
|
18
|
+
|
|
19
|
+
</Step>
|
|
20
|
+
<Step>
|
|
21
|
+
|
|
22
|
+
### Use in your application
|
|
23
|
+
|
|
24
|
+
Pass `Image` to `MessagePrimitive.Parts`:
|
|
25
|
+
|
|
26
|
+
```tsx title="/components/assistant-ui/thread.tsx" {1,8}
|
|
27
|
+
import { Image } from "@/components/assistant-ui/image";
|
|
28
|
+
|
|
29
|
+
const AssistantMessage: FC = () => {
|
|
30
|
+
return (
|
|
31
|
+
<MessagePrimitive.Root className="...">
|
|
32
|
+
<MessagePrimitive.Parts
|
|
33
|
+
components={{
|
|
34
|
+
Image,
|
|
35
|
+
}}
|
|
36
|
+
/>
|
|
37
|
+
</MessagePrimitive.Root>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
</Step>
|
|
43
|
+
</Steps>
|
|
44
|
+
|
|
45
|
+
## Variants
|
|
46
|
+
|
|
47
|
+
Use the `variant` prop to change the visual style.
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
<Image.Root variant="outline" /> // Border (default)
|
|
51
|
+
<Image.Root variant="ghost" /> // No border
|
|
52
|
+
<Image.Root variant="muted" /> // Background fill
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Sizes
|
|
56
|
+
|
|
57
|
+
Use the `size` prop to control the maximum width.
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
<Image.Root size="sm" /> // max-w-64 (256px)
|
|
61
|
+
<Image.Root size="default" /> // max-w-96 (384px)
|
|
62
|
+
<Image.Root size="lg" /> // max-w-[512px]
|
|
63
|
+
<Image.Root size="full" /> // w-full
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## API Reference
|
|
67
|
+
|
|
68
|
+
### Composable API
|
|
69
|
+
|
|
70
|
+
The component exports composable sub-components:
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import {
|
|
74
|
+
Image,
|
|
75
|
+
ImageRoot,
|
|
76
|
+
ImagePreview,
|
|
77
|
+
ImageFilename,
|
|
78
|
+
ImageZoom,
|
|
79
|
+
} from "@/components/assistant-ui/image";
|
|
80
|
+
|
|
81
|
+
<ImageRoot variant="muted" size="lg">
|
|
82
|
+
<ImageZoom src="https://example.com/photo.jpg" alt="Photo">
|
|
83
|
+
<ImagePreview src="https://example.com/photo.jpg" alt="Photo" />
|
|
84
|
+
</ImageZoom>
|
|
85
|
+
<ImageFilename>photo.jpg</ImageFilename>
|
|
86
|
+
</ImageRoot>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
| Component | Description |
|
|
90
|
+
|-----------|-------------|
|
|
91
|
+
| `Image` | Default export, renders complete image part |
|
|
92
|
+
| `Image.Root` | Container with variant and size styling |
|
|
93
|
+
| `Image.Preview` | Image container with loading/error states |
|
|
94
|
+
| `Image.Filename` | Optional filename display below image |
|
|
95
|
+
| `Image.Zoom` | Medium-style zoom overlay (click to expand, ESC to close) |
|
|
96
|
+
|
|
97
|
+
## Related Components
|
|
98
|
+
|
|
99
|
+
- [Attachment](/docs/ui/attachment) - File attachments in composer and messages
|
|
100
|
+
- [File](/docs/ui/file) - Non-image file message parts
|
|
@@ -3,7 +3,6 @@ title: Markdown
|
|
|
3
3
|
description: Display rich text with headings, lists, links, and code blocks.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
7
6
|
import { MarkdownSample } from "@/components/docs/samples/markdown";
|
|
8
7
|
|
|
9
8
|
<MarkdownSample />
|
|
@@ -3,7 +3,6 @@ title: "Mermaid Diagrams"
|
|
|
3
3
|
description: Render Mermaid diagrams in chat messages with streaming support.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
7
6
|
import { MermaidSample } from "@/components/docs/samples/mermaid";
|
|
8
7
|
|
|
9
8
|
<MermaidSample />
|