@assistant-ui/mcp-docs-server 0.1.17 → 0.1.19
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 +518 -234
- package/.docs/organized/code-examples/{with-ai-sdk-v5.md → with-ai-sdk-v6.md} +476 -189
- package/.docs/organized/code-examples/with-assistant-transport.md +503 -301
- package/.docs/organized/code-examples/with-cloud.md +524 -226
- package/.docs/organized/code-examples/with-custom-thread-list.md +433 -146
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +2241 -0
- package/.docs/organized/code-examples/with-external-store.md +517 -231
- package/.docs/organized/code-examples/with-ffmpeg.md +500 -220
- package/.docs/organized/code-examples/with-langgraph.md +630 -319
- package/.docs/organized/code-examples/with-parent-id-grouping.md +517 -231
- package/.docs/organized/code-examples/with-react-hook-form.md +517 -233
- package/.docs/organized/code-examples/with-react-router.md +2167 -0
- package/.docs/organized/code-examples/{store-example.md → with-store.md} +18 -22
- package/.docs/organized/code-examples/with-tanstack.md +23 -41
- package/.docs/raw/blog/2025-01-31-changelog/index.mdx +0 -2
- package/.docs/raw/docs/{about-assistantui.mdx → (docs)/about-assistantui.mdx} +2 -1
- package/.docs/raw/docs/{architecture.mdx → (docs)/architecture.mdx} +3 -2
- package/.docs/raw/docs/{cli.mdx → (docs)/cli.mdx} +1 -19
- 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 +1 -0
- package/.docs/raw/docs/{copilots → (docs)/copilots}/motivation.mdx +1 -0
- 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} +4 -5
- package/.docs/raw/docs/{guides/Branching.mdx → (docs)/guides/branching.mdx} +2 -1
- package/.docs/raw/docs/{guides → (docs)/guides}/context-api.mdx +1 -0
- 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/{guides/ToolUI.mdx → (docs)/guides/tool-ui.mdx} +15 -14
- package/.docs/raw/docs/{guides/Tools.mdx → (docs)/guides/tools.mdx} +10 -7
- package/.docs/raw/docs/{getting-started.mdx → (docs)/index.mdx} +17 -22
- package/.docs/raw/docs/{mcp-docs-server.mdx → (docs)/mcp-docs-server.mdx} +1 -2
- 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 +2 -1
- 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 +1 -1
- 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} +3 -1
- package/.docs/raw/docs/{api-reference/primitives/AssistantIf.mdx → (reference)/api-reference/primitives/assistant-if.mdx} +2 -2
- 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/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} +2 -1
- 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} +1 -0
- 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/{migrations → (reference)/migrations}/v0-12.mdx +1 -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 +7 -6
- package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +38 -3
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +6 -8
- package/.docs/raw/docs/runtimes/custom/local.mdx +43 -16
- package/.docs/raw/docs/runtimes/data-stream.mdx +32 -4
- 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/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/{Markdown.mdx → markdown.mdx} +11 -6
- package/.docs/raw/docs/ui/{Mermaid.mdx → mermaid.mdx} +12 -5
- package/.docs/raw/docs/ui/{PartGrouping.mdx → part-grouping.mdx} +4 -6
- package/.docs/raw/docs/ui/reasoning.mdx +148 -0
- package/.docs/raw/docs/ui/{Scrollbar.mdx → scrollbar.mdx} +9 -7
- package/.docs/raw/docs/ui/sources.mdx +87 -0
- package/.docs/raw/docs/ui/{SyntaxHighlighting.mdx → syntax-highlighting.mdx} +9 -5
- package/.docs/raw/docs/ui/thread-list.mdx +275 -0
- package/.docs/raw/docs/ui/{Thread.mdx → thread.mdx} +5 -6
- package/.docs/raw/docs/ui/tool-fallback.mdx +112 -0
- package/.docs/raw/docs/ui/tool-group.mdx +214 -0
- package/dist/constants.d.ts +10 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +14 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -1
- package/dist/index.js.map +1 -0
- package/dist/prepare-docs/code-examples.d.ts +2 -0
- package/dist/prepare-docs/code-examples.d.ts.map +1 -0
- package/dist/prepare-docs/code-examples.js +129 -0
- package/dist/prepare-docs/code-examples.js.map +1 -0
- package/dist/prepare-docs/copy-raw.d.ts +2 -0
- package/dist/prepare-docs/copy-raw.d.ts.map +1 -0
- package/dist/prepare-docs/copy-raw.js +50 -0
- package/dist/prepare-docs/copy-raw.js.map +1 -0
- package/dist/prepare-docs/prepare.d.ts +2 -0
- package/dist/prepare-docs/prepare.d.ts.map +1 -0
- package/dist/prepare-docs/prepare.js +18 -195
- package/dist/prepare-docs/prepare.js.map +1 -0
- package/dist/stdio.d.ts +3 -0
- package/dist/stdio.d.ts.map +1 -0
- package/dist/stdio.js +4 -5
- package/dist/stdio.js.map +1 -0
- package/dist/tools/docs.d.ts +23 -0
- package/dist/tools/docs.d.ts.map +1 -0
- package/dist/tools/docs.js +168 -0
- package/dist/tools/docs.js.map +1 -0
- package/dist/tools/examples.d.ts +23 -0
- package/dist/tools/examples.d.ts.map +1 -0
- package/dist/tools/examples.js +95 -0
- package/dist/tools/examples.js.map +1 -0
- package/dist/tools/tests/test-setup.d.ts +4 -0
- package/dist/tools/tests/test-setup.d.ts.map +1 -0
- package/dist/tools/tests/test-setup.js +36 -0
- package/dist/tools/tests/test-setup.js.map +1 -0
- package/dist/utils/logger.d.ts +7 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +20 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/mcp-format.d.ts +7 -0
- package/dist/utils/mcp-format.d.ts.map +1 -0
- package/dist/utils/mcp-format.js +11 -0
- package/dist/utils/mcp-format.js.map +1 -0
- package/dist/utils/mdx.d.ts +9 -0
- package/dist/utils/mdx.d.ts.map +1 -0
- package/dist/utils/mdx.js +27 -0
- package/dist/utils/mdx.js.map +1 -0
- package/dist/utils/paths.d.ts +8 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +84 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/security.d.ts +2 -0
- package/dist/utils/security.d.ts.map +1 -0
- package/dist/utils/security.js +43 -0
- package/dist/utils/security.js.map +1 -0
- package/package.json +37 -19
- package/src/constants.ts +22 -0
- package/src/index.ts +51 -0
- package/src/prepare-docs/code-examples.ts +158 -0
- package/src/prepare-docs/copy-raw.ts +55 -0
- package/src/prepare-docs/prepare.ts +24 -0
- package/src/stdio.ts +7 -0
- package/src/tools/docs.ts +207 -0
- package/src/tools/examples.ts +107 -0
- package/src/tools/tests/docs.test.ts +124 -0
- package/src/tools/tests/examples.test.ts +94 -0
- package/src/tools/tests/integration.test.ts +46 -0
- package/src/tools/tests/json-parsing.test.ts +23 -0
- package/src/tools/tests/mcp-protocol.test.ts +133 -0
- package/src/tools/tests/path-traversal.test.ts +81 -0
- package/src/tools/tests/test-setup.ts +40 -0
- package/src/utils/logger.ts +20 -0
- package/src/utils/mcp-format.ts +12 -0
- package/src/utils/mdx.ts +39 -0
- package/src/utils/paths.ts +114 -0
- package/src/utils/security.ts +52 -0
- package/src/utils/tests/security.test.ts +119 -0
- package/.docs/raw/docs/index.mdx +0 -7
- 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/dist/chunk-M2RKUM66.js +0 -38
- package/dist/chunk-NVNFQ5ZO.js +0 -423
- /package/.docs/raw/docs/{copilots → (docs)/copilots}/assistant-frame.mdx +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: AssistantSidebar
|
|
3
|
+
description: Side panel chat for co-pilot experiences and inline assistance.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { ParametersTable } from "@/components/docs/tables/ParametersTable";
|
|
7
|
+
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
8
|
+
import { AssistantSidebarSample } from "@/components/docs/samples/assistant-sidebar";
|
|
9
|
+
|
|
10
|
+
A resizable side panel layout with your main content on the left and a Thread chat interface on the right. Ideal for co-pilot experiences and inline assistance.
|
|
11
|
+
|
|
12
|
+
<AssistantSidebarSample />
|
|
13
|
+
|
|
14
|
+
## Getting Started
|
|
15
|
+
|
|
16
|
+
<Steps>
|
|
17
|
+
<Step>
|
|
18
|
+
|
|
19
|
+
### Add `assistant-sidebar`
|
|
20
|
+
|
|
21
|
+
<InstallCommand shadcn={["assistant-sidebar"]} />
|
|
22
|
+
|
|
23
|
+
This adds `/components/assistant-ui/assistant-sidebar.tsx` to your project, which you can adjust as needed.
|
|
24
|
+
|
|
25
|
+
</Step>
|
|
26
|
+
<Step>
|
|
27
|
+
|
|
28
|
+
### Use in your application
|
|
29
|
+
|
|
30
|
+
```tsx title="/app/page.tsx" {1,6}
|
|
31
|
+
import { AssistantSidebar } from "@/components/assistant-ui/assistant-sidebar";
|
|
32
|
+
|
|
33
|
+
export default function Home() {
|
|
34
|
+
return (
|
|
35
|
+
<div className="h-full">
|
|
36
|
+
<AssistantSidebar>{/* your app */}</AssistantSidebar>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
</Step>
|
|
43
|
+
</Steps>
|
|
44
|
+
|
|
45
|
+
## API Reference
|
|
46
|
+
|
|
47
|
+
### AssistantSidebar
|
|
48
|
+
|
|
49
|
+
A layout component that creates a resizable two-panel interface.
|
|
50
|
+
|
|
51
|
+
<ParametersTable
|
|
52
|
+
type="AssistantSidebarProps"
|
|
53
|
+
parameters={[
|
|
54
|
+
{
|
|
55
|
+
name: "children",
|
|
56
|
+
type: "ReactNode",
|
|
57
|
+
description: "Content to display in the left panel (your main application).",
|
|
58
|
+
},
|
|
59
|
+
]}
|
|
60
|
+
/>
|
|
61
|
+
|
|
62
|
+
The component uses `ResizablePanelGroup` from shadcn/ui internally, creating:
|
|
63
|
+
- **Left panel**: Your application content (passed as `children`)
|
|
64
|
+
- **Right panel**: The Thread chat interface (rendered automatically)
|
|
65
|
+
- **Resize handle**: Draggable divider between panels
|
|
66
|
+
|
|
67
|
+
## Customization
|
|
68
|
+
|
|
69
|
+
Since this component is copied to your project at `/components/assistant-ui/assistant-sidebar.tsx`, you can customize:
|
|
70
|
+
|
|
71
|
+
- Panel default sizes and min/max constraints
|
|
72
|
+
- Resize handle styling
|
|
73
|
+
- Thread component configuration
|
|
74
|
+
|
|
75
|
+
```tsx title="/components/assistant-ui/assistant-sidebar.tsx"
|
|
76
|
+
<ResizablePanelGroup direction="horizontal">
|
|
77
|
+
<ResizablePanel defaultSize={60} minSize={30}>
|
|
78
|
+
{children}
|
|
79
|
+
</ResizablePanel>
|
|
80
|
+
<ResizableHandle withHandle />
|
|
81
|
+
<ResizablePanel defaultSize={40} minSize={20}>
|
|
82
|
+
<Thread />
|
|
83
|
+
</ResizablePanel>
|
|
84
|
+
</ResizablePanelGroup>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Related Components
|
|
88
|
+
|
|
89
|
+
- [Thread](/docs/ui/thread) - The chat interface displayed in the sidebar
|
|
90
|
+
- [AssistantModal](/docs/ui/assistant-modal) - Alternative floating modal layout
|
|
@@ -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
|
|
@@ -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
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Message Part Grouping
|
|
3
|
+
description: Organize message parts into custom groups with flexible grouping functions.
|
|
3
4
|
---
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { ParametersTable } from "@/components/docs";
|
|
6
|
+
import { ParametersTable } from "@/components/docs/tables/ParametersTable";
|
|
7
|
+
import { PartGroupingSample } from "@/components/docs/samples/part-grouping";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
<PartGroupingSample />
|
|
10
10
|
|
|
11
11
|
<Callout type="warn">
|
|
12
12
|
This feature is experimental and the API may change in future versions.
|
|
13
13
|
</Callout>
|
|
14
14
|
|
|
15
|
-
The Message Part Grouping feature allows you to organize and display message parts in custom groups using a flexible grouping function. This is useful for creating visual hierarchies, organizing related content together, or building custom UI patterns based on message part characteristics.
|
|
16
|
-
|
|
17
15
|
## Basic Usage
|
|
18
16
|
|
|
19
17
|
Use the `MessagePrimitive.Unstable_PartsGrouped` component with a custom grouping function:
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Reasoning
|
|
3
|
+
description: Collapsible UI for displaying AI reasoning and thinking messages.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
7
|
+
import { ReasoningSample, ReasoningGroupSample } from "@/components/docs/samples/reasoning";
|
|
8
|
+
|
|
9
|
+
<ReasoningSample />
|
|
10
|
+
|
|
11
|
+
## Getting Started
|
|
12
|
+
|
|
13
|
+
<Steps>
|
|
14
|
+
<Step>
|
|
15
|
+
|
|
16
|
+
### Add `reasoning`
|
|
17
|
+
|
|
18
|
+
<InstallCommand shadcn={["reasoning"]} />
|
|
19
|
+
|
|
20
|
+
This adds a `/components/assistant-ui/reasoning.tsx` file to your project.
|
|
21
|
+
|
|
22
|
+
</Step>
|
|
23
|
+
<Step>
|
|
24
|
+
|
|
25
|
+
### Use in your application
|
|
26
|
+
|
|
27
|
+
Pass the `Reasoning` and `ReasoningGroup` components to the `MessagePrimitive.Parts` component:
|
|
28
|
+
|
|
29
|
+
```tsx title="/app/components/assistant-ui/thread.tsx" {2,10-11}
|
|
30
|
+
import { MessagePrimitive } from "@assistant-ui/react";
|
|
31
|
+
import { Reasoning, ReasoningGroup } from "@/components/assistant-ui/reasoning";
|
|
32
|
+
|
|
33
|
+
const AssistantMessage: FC = () => {
|
|
34
|
+
return (
|
|
35
|
+
<MessagePrimitive.Root className="...">
|
|
36
|
+
<div className="...">
|
|
37
|
+
<MessagePrimitive.Parts
|
|
38
|
+
components={{
|
|
39
|
+
Reasoning: Reasoning,
|
|
40
|
+
ReasoningGroup: ReasoningGroup
|
|
41
|
+
}}
|
|
42
|
+
/>
|
|
43
|
+
</div>
|
|
44
|
+
<AssistantActionBar />
|
|
45
|
+
<BranchPicker className="..." />
|
|
46
|
+
</MessagePrimitive.Root>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
</Step>
|
|
52
|
+
</Steps>
|
|
53
|
+
|
|
54
|
+
## How It Works
|
|
55
|
+
|
|
56
|
+
The component consists of two parts:
|
|
57
|
+
|
|
58
|
+
1. **Reasoning**: Renders individual reasoning message part content (with markdown support)
|
|
59
|
+
2. **ReasoningGroup**: Wraps consecutive reasoning parts in a collapsible container
|
|
60
|
+
|
|
61
|
+
Consecutive reasoning parts are automatically grouped together by the `ReasoningGroup` component.
|
|
62
|
+
|
|
63
|
+
> When using the composable API, `Reasoning.Text` is a plain container. Add `<MarkdownText />` for markdown rendering.
|
|
64
|
+
|
|
65
|
+
## Variants
|
|
66
|
+
|
|
67
|
+
Use the `variant` prop on `Reasoning.Root` to change the visual style:
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
<Reasoning.Root variant="outline">...</Reasoning.Root>
|
|
71
|
+
<Reasoning.Root variant="muted">...</Reasoning.Root>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
| Variant | Description |
|
|
75
|
+
| --------- | ---------------------------------- |
|
|
76
|
+
| `default` | No additional styling |
|
|
77
|
+
| `muted` | Muted background |
|
|
78
|
+
| `outline` | Rounded border |
|
|
79
|
+
|
|
80
|
+
## ReasoningGroup
|
|
81
|
+
|
|
82
|
+
`ReasoningGroup` wraps consecutive reasoning parts in a collapsible container. It auto-expands during streaming.
|
|
83
|
+
|
|
84
|
+
<ReasoningGroupSample />
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
import { ReasoningGroup } from "@/components/assistant-ui/reasoning";
|
|
88
|
+
|
|
89
|
+
const ReasoningGroupImpl: ReasoningGroupComponent = ({
|
|
90
|
+
children,
|
|
91
|
+
startIndex,
|
|
92
|
+
endIndex,
|
|
93
|
+
}) => {
|
|
94
|
+
const isReasoningStreaming = useAssistantState(({ message }) => {
|
|
95
|
+
if (message.status?.type !== "running") return false;
|
|
96
|
+
const lastIndex = message.parts.length - 1;
|
|
97
|
+
if (lastIndex < 0) return false;
|
|
98
|
+
const lastType = message.parts[lastIndex]?.type;
|
|
99
|
+
if (lastType !== "reasoning") return false;
|
|
100
|
+
return lastIndex >= startIndex && lastIndex <= endIndex;
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<ReasoningRoot defaultOpen={isReasoningStreaming}>
|
|
105
|
+
<ReasoningTrigger active={isReasoningStreaming} />
|
|
106
|
+
<ReasoningContent aria-busy={isReasoningStreaming}>
|
|
107
|
+
<ReasoningText>{children}</ReasoningText>
|
|
108
|
+
</ReasoningContent>
|
|
109
|
+
</ReasoningRoot>
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Composable API
|
|
115
|
+
|
|
116
|
+
All sub-components are exported for custom layouts:
|
|
117
|
+
|
|
118
|
+
| Component | Description |
|
|
119
|
+
| --------------------- | ------------------------------------------ |
|
|
120
|
+
| `Reasoning.Root` | Collapsible container with scroll lock |
|
|
121
|
+
| `Reasoning.Trigger` | Button with icon, label, and shimmer |
|
|
122
|
+
| `Reasoning.Content` | Animated collapsible content wrapper |
|
|
123
|
+
| `Reasoning.Text` | Text wrapper with slide/fade animation |
|
|
124
|
+
| `Reasoning.Fade` | Gradient fade overlay at bottom |
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
import {
|
|
128
|
+
Reasoning,
|
|
129
|
+
ReasoningRoot,
|
|
130
|
+
ReasoningTrigger,
|
|
131
|
+
ReasoningContent,
|
|
132
|
+
ReasoningText,
|
|
133
|
+
ReasoningFade,
|
|
134
|
+
} from "@/components/assistant-ui/reasoning";
|
|
135
|
+
|
|
136
|
+
// Compound component syntax
|
|
137
|
+
<Reasoning.Root variant="muted">
|
|
138
|
+
<Reasoning.Trigger active={isStreaming} />
|
|
139
|
+
<Reasoning.Content>
|
|
140
|
+
<Reasoning.Text>{children}</Reasoning.Text>
|
|
141
|
+
</Reasoning.Content>
|
|
142
|
+
</Reasoning.Root>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Related Components
|
|
146
|
+
|
|
147
|
+
- [ToolGroup](/docs/ui/tool-group) - Similar grouping pattern for tool calls
|
|
148
|
+
- [PartGrouping](/docs/ui/part-grouping) - Experimental API for grouping message parts
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Custom Scrollbar
|
|
3
|
+
description: Replace the default scrollbar with a custom Radix UI scroll area.
|
|
3
4
|
---
|
|
4
5
|
|
|
5
|
-
import { InstallCommand } from "@/components/docs/install-command";
|
|
6
|
+
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
7
|
+
import { ScrollbarSample } from "@/components/docs/samples/scrollbar";
|
|
8
|
+
|
|
9
|
+
<ScrollbarSample />
|
|
6
10
|
|
|
7
11
|
If you want to show a custom scrollbar UI of the Thread.Viewport in place of the system default, you can integrate `@radix-ui/react-scroll-area`.
|
|
8
12
|
An example implementation of this is [shadcn/ui's Scroll Area](https://ui.shadcn.com/docs/components/scroll-area).
|
|
@@ -11,12 +15,6 @@ An example implementation of this is [shadcn/ui's Scroll Area](https://ui.shadcn
|
|
|
11
15
|
|
|
12
16
|
<InstallCommand shadcn={["scroll-area"]} />
|
|
13
17
|
|
|
14
|
-
### @radix-ui/react-scroll-area v1.2.0 release candidate required
|
|
15
|
-
|
|
16
|
-
The v1.2.0-rc.x release candidate can be installed via
|
|
17
|
-
|
|
18
|
-
<InstallCommand npm={["@radix-ui/react-scroll-area@next"]} />
|
|
19
|
-
|
|
20
18
|
## Additional Styles
|
|
21
19
|
|
|
22
20
|
The Radix UI Viewport component adds an intermediate `<div data-radix-scroll-area-content>` element.
|
|
@@ -55,3 +53,7 @@ const MyThread: FC = () => {
|
|
|
55
53
|
);
|
|
56
54
|
};
|
|
57
55
|
```
|
|
56
|
+
|
|
57
|
+
## Related Components
|
|
58
|
+
|
|
59
|
+
- [Thread](/docs/ui/thread) - The main chat interface where the scrollbar is used
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Sources
|
|
3
|
+
description: Display URL sources with favicon, title, and external link.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
7
|
+
import { SourcesSample } from "@/components/docs/samples/sources";
|
|
8
|
+
|
|
9
|
+
<SourcesSample />
|
|
10
|
+
|
|
11
|
+
## Getting Started
|
|
12
|
+
|
|
13
|
+
<Steps>
|
|
14
|
+
<Step>
|
|
15
|
+
|
|
16
|
+
### Add `sources`
|
|
17
|
+
|
|
18
|
+
<InstallCommand shadcn={["sources"]} />
|
|
19
|
+
|
|
20
|
+
</Step>
|
|
21
|
+
<Step>
|
|
22
|
+
|
|
23
|
+
### Use in your application
|
|
24
|
+
|
|
25
|
+
Pass `Sources` to `MessagePrimitive.Parts`:
|
|
26
|
+
|
|
27
|
+
```tsx title="/components/assistant-ui/thread.tsx" {1,8}
|
|
28
|
+
import { Sources } from "@/components/assistant-ui/sources";
|
|
29
|
+
|
|
30
|
+
const AssistantMessage: FC = () => {
|
|
31
|
+
return (
|
|
32
|
+
<MessagePrimitive.Root className="...">
|
|
33
|
+
<MessagePrimitive.Parts
|
|
34
|
+
components={{
|
|
35
|
+
Source: Sources,
|
|
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
|
+
<Source variant="default" /> // Default
|
|
52
|
+
<Source variant="outline" /> // Border only
|
|
53
|
+
<Source variant="ghost" /> // No background
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Sizes
|
|
57
|
+
|
|
58
|
+
Use the `size` prop to change the size.
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
<Source size="sm" /> // Small
|
|
62
|
+
<Source size="default" /> // Default
|
|
63
|
+
<Source size="lg" /> // Large
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Composable API
|
|
67
|
+
|
|
68
|
+
The component exports composable sub-components:
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
import { Source, SourceIcon, SourceTitle } from "@/components/assistant-ui/sources";
|
|
72
|
+
|
|
73
|
+
<Source href="https://example.com" className="gap-2">
|
|
74
|
+
<SourceIcon url="https://example.com" className="size-4" />
|
|
75
|
+
<SourceTitle className="max-w-none font-medium">Example</SourceTitle>
|
|
76
|
+
</Source>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
| Component | Description |
|
|
80
|
+
|-----------|-------------|
|
|
81
|
+
| `Source` | Root container, renders as `<a>` |
|
|
82
|
+
| `SourceIcon` | Favicon with domain initial fallback |
|
|
83
|
+
| `SourceTitle` | Truncated title text |
|
|
84
|
+
|
|
85
|
+
## Related
|
|
86
|
+
|
|
87
|
+
- [PartGrouping](/docs/ui/part-grouping) - Group sources by parentId
|