@assistant-ui/mcp-docs-server 0.1.1

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.
Files changed (109) hide show
  1. package/.docs/organized/code-examples/local-ollama.md +1135 -0
  2. package/.docs/organized/code-examples/search-agent-for-e-commerce.md +1721 -0
  3. package/.docs/organized/code-examples/with-ai-sdk.md +1081 -0
  4. package/.docs/organized/code-examples/with-cloud.md +1164 -0
  5. package/.docs/organized/code-examples/with-external-store.md +1064 -0
  6. package/.docs/organized/code-examples/with-ffmpeg.md +1305 -0
  7. package/.docs/organized/code-examples/with-langgraph.md +1819 -0
  8. package/.docs/organized/code-examples/with-openai-assistants.md +1175 -0
  9. package/.docs/organized/code-examples/with-react-hook-form.md +1727 -0
  10. package/.docs/organized/code-examples/with-vercel-ai-rsc.md +1157 -0
  11. package/.docs/raw/blog/2024-07-29-hello/index.mdx +65 -0
  12. package/.docs/raw/blog/2024-09-11/index.mdx +10 -0
  13. package/.docs/raw/blog/2024-12-15/index.mdx +10 -0
  14. package/.docs/raw/blog/2025-01-31-changelog/index.mdx +129 -0
  15. package/.docs/raw/docs/about-assistantui.mdx +44 -0
  16. package/.docs/raw/docs/api-reference/context-providers/AssistantRuntimeProvider.mdx +30 -0
  17. package/.docs/raw/docs/api-reference/context-providers/TextContentPartProvider.mdx +26 -0
  18. package/.docs/raw/docs/api-reference/integrations/react-hook-form.mdx +103 -0
  19. package/.docs/raw/docs/api-reference/integrations/vercel-ai-sdk.mdx +145 -0
  20. package/.docs/raw/docs/api-reference/overview.mdx +583 -0
  21. package/.docs/raw/docs/api-reference/primitives/ActionBar.mdx +264 -0
  22. package/.docs/raw/docs/api-reference/primitives/AssistantModal.mdx +129 -0
  23. package/.docs/raw/docs/api-reference/primitives/Attachment.mdx +96 -0
  24. package/.docs/raw/docs/api-reference/primitives/BranchPicker.mdx +87 -0
  25. package/.docs/raw/docs/api-reference/primitives/Composer.mdx +204 -0
  26. package/.docs/raw/docs/api-reference/primitives/ContentPart.mdx +173 -0
  27. package/.docs/raw/docs/api-reference/primitives/Error.mdx +70 -0
  28. package/.docs/raw/docs/api-reference/primitives/Message.mdx +181 -0
  29. package/.docs/raw/docs/api-reference/primitives/Thread.mdx +197 -0
  30. package/.docs/raw/docs/api-reference/primitives/composition.mdx +21 -0
  31. package/.docs/raw/docs/api-reference/runtimes/AssistantRuntime.mdx +33 -0
  32. package/.docs/raw/docs/api-reference/runtimes/AttachmentRuntime.mdx +46 -0
  33. package/.docs/raw/docs/api-reference/runtimes/ComposerRuntime.mdx +69 -0
  34. package/.docs/raw/docs/api-reference/runtimes/ContentPartRuntime.mdx +22 -0
  35. package/.docs/raw/docs/api-reference/runtimes/MessageRuntime.mdx +49 -0
  36. package/.docs/raw/docs/api-reference/runtimes/ThreadListItemRuntime.mdx +32 -0
  37. package/.docs/raw/docs/api-reference/runtimes/ThreadListRuntime.mdx +31 -0
  38. package/.docs/raw/docs/api-reference/runtimes/ThreadRuntime.mdx +48 -0
  39. package/.docs/raw/docs/architecture.mdx +92 -0
  40. package/.docs/raw/docs/cloud/authorization.mdx +152 -0
  41. package/.docs/raw/docs/cloud/overview.mdx +55 -0
  42. package/.docs/raw/docs/cloud/persistence/ai-sdk.mdx +54 -0
  43. package/.docs/raw/docs/cloud/persistence/langgraph.mdx +123 -0
  44. package/.docs/raw/docs/concepts/architecture.mdx +19 -0
  45. package/.docs/raw/docs/concepts/runtime-layer.mdx +163 -0
  46. package/.docs/raw/docs/concepts/why.mdx +9 -0
  47. package/.docs/raw/docs/copilots/make-assistant-readable.mdx +71 -0
  48. package/.docs/raw/docs/copilots/make-assistant-tool-ui.mdx +76 -0
  49. package/.docs/raw/docs/copilots/make-assistant-tool.mdx +117 -0
  50. package/.docs/raw/docs/copilots/model-context.mdx +135 -0
  51. package/.docs/raw/docs/copilots/motivation.mdx +191 -0
  52. package/.docs/raw/docs/copilots/use-assistant-instructions.mdx +62 -0
  53. package/.docs/raw/docs/getting-started.mdx +1133 -0
  54. package/.docs/raw/docs/guides/Attachments.mdx +640 -0
  55. package/.docs/raw/docs/guides/Branching.mdx +59 -0
  56. package/.docs/raw/docs/guides/Editing.mdx +56 -0
  57. package/.docs/raw/docs/guides/Speech.mdx +43 -0
  58. package/.docs/raw/docs/guides/ToolUI.mdx +663 -0
  59. package/.docs/raw/docs/guides/Tools.mdx +496 -0
  60. package/.docs/raw/docs/index.mdx +7 -0
  61. package/.docs/raw/docs/legacy/styled/AssistantModal.mdx +85 -0
  62. package/.docs/raw/docs/legacy/styled/Decomposition.mdx +633 -0
  63. package/.docs/raw/docs/legacy/styled/Markdown.mdx +86 -0
  64. package/.docs/raw/docs/legacy/styled/Scrollbar.mdx +71 -0
  65. package/.docs/raw/docs/legacy/styled/Thread.mdx +84 -0
  66. package/.docs/raw/docs/legacy/styled/ThreadWidth.mdx +21 -0
  67. package/.docs/raw/docs/mcp-docs-server.mdx +324 -0
  68. package/.docs/raw/docs/migrations/deprecation-policy.mdx +41 -0
  69. package/.docs/raw/docs/migrations/v0-7.mdx +188 -0
  70. package/.docs/raw/docs/migrations/v0-8.mdx +160 -0
  71. package/.docs/raw/docs/migrations/v0-9.mdx +75 -0
  72. package/.docs/raw/docs/react-compatibility.mdx +208 -0
  73. package/.docs/raw/docs/runtimes/ai-sdk/rsc.mdx +226 -0
  74. package/.docs/raw/docs/runtimes/ai-sdk/use-assistant-hook.mdx +195 -0
  75. package/.docs/raw/docs/runtimes/ai-sdk/use-chat-hook.mdx +138 -0
  76. package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +136 -0
  77. package/.docs/raw/docs/runtimes/custom/external-store.mdx +1624 -0
  78. package/.docs/raw/docs/runtimes/custom/local.mdx +1185 -0
  79. package/.docs/raw/docs/runtimes/helicone.mdx +60 -0
  80. package/.docs/raw/docs/runtimes/langgraph/index.mdx +320 -0
  81. package/.docs/raw/docs/runtimes/langgraph/tutorial/index.mdx +11 -0
  82. package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +28 -0
  83. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +120 -0
  84. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +336 -0
  85. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +385 -0
  86. package/.docs/raw/docs/runtimes/langserve.mdx +126 -0
  87. package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +218 -0
  88. package/.docs/raw/docs/runtimes/mastra/overview.mdx +17 -0
  89. package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +196 -0
  90. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +222 -0
  91. package/.docs/raw/docs/ui/AssistantModal.mdx +46 -0
  92. package/.docs/raw/docs/ui/AssistantSidebar.mdx +42 -0
  93. package/.docs/raw/docs/ui/Attachment.mdx +82 -0
  94. package/.docs/raw/docs/ui/Markdown.mdx +72 -0
  95. package/.docs/raw/docs/ui/Mermaid.mdx +79 -0
  96. package/.docs/raw/docs/ui/Scrollbar.mdx +59 -0
  97. package/.docs/raw/docs/ui/SyntaxHighlighting.mdx +253 -0
  98. package/.docs/raw/docs/ui/Thread.mdx +47 -0
  99. package/.docs/raw/docs/ui/ThreadList.mdx +49 -0
  100. package/.docs/raw/docs/ui/ToolFallback.mdx +64 -0
  101. package/.docs/raw/docs/ui/primitives/Thread.mdx +197 -0
  102. package/LICENSE +21 -0
  103. package/README.md +128 -0
  104. package/dist/chunk-C7O7EFKU.js +38 -0
  105. package/dist/chunk-CZCDQ3YH.js +420 -0
  106. package/dist/index.js +1 -0
  107. package/dist/prepare-docs/prepare.js +199 -0
  108. package/dist/stdio.js +8 -0
  109. package/package.json +43 -0
@@ -0,0 +1,46 @@
1
+ ---
2
+ title: AssistantModal
3
+ ---
4
+
5
+ import { Steps, Step } from "fumadocs-ui/components/steps";
6
+ import { AssistantModalSample } from "../../../components/samples/assistant-modal-sample";
7
+
8
+ ## Overview
9
+
10
+ A chat bubble shown in the bottom right corner of the screen. Useful for support or Q&A use cases.
11
+
12
+ <AssistantModalSample />
13
+
14
+
15
+ ## Getting Started
16
+
17
+ <Steps>
18
+ <Step>
19
+
20
+ ### Add `assistant-modal`
21
+
22
+ ```sh
23
+ npx shadcn@latest add "https://r.assistant-ui.com/assistant-modal"
24
+ ```
25
+
26
+ This adds `/components/assistant-ui/assistant-modal.tsx` to your project, which you can adjust as needed.
27
+
28
+ </Step>
29
+ <Step>
30
+
31
+ ### Use in your application
32
+
33
+ ```tsx title="/app/page.tsx" {1,6}
34
+ import { AssistantModal } from "@/components/assistant-ui/assistant-modal";
35
+
36
+ export default function Home() {
37
+ return (
38
+ <div className="h-full">
39
+ <AssistantModal />
40
+ </div>
41
+ );
42
+ }
43
+ ```
44
+
45
+ </Step>
46
+ </Steps>
@@ -0,0 +1,42 @@
1
+ ---
2
+ title: AssistantSidebar
3
+ ---
4
+
5
+ import { Steps, Step } from "fumadocs-ui/components/steps";
6
+
7
+ ## Overview
8
+
9
+ A chat sidebar show on the right side of the screen. Useful for co-pilot use cases.
10
+
11
+ ## Getting Started
12
+
13
+ <Steps>
14
+ <Step>
15
+
16
+ ### Add `assistant-sidebar`
17
+
18
+ ```sh
19
+ npx shadcn@latest add "https://r.assistant-ui.com/assistant-sidebar"
20
+ ```
21
+
22
+ This adds `/components/assistant-ui/assistant-sidebar.tsx` to your project, which you can adjust as needed.
23
+
24
+ </Step>
25
+ <Step>
26
+
27
+ ### Use in your application
28
+
29
+ ```tsx title="/app/page.tsx" {1,6}
30
+ import { AssistantSidebar } from "@/components/assistant-ui/assistant-sidebar";
31
+
32
+ export default function Home() {
33
+ return (
34
+ <div className="h-full">
35
+ <AssistantSidebar>{/* your app */}</AssistantSidebar>
36
+ </div>
37
+ );
38
+ }
39
+ ```
40
+
41
+ </Step>
42
+ </Steps>
@@ -0,0 +1,82 @@
1
+ ---
2
+ title: Attachment
3
+ ---
4
+
5
+ import { Steps, Step } from "fumadocs-ui/components/steps";
6
+ import { AttachmentSample } from "../../../components/samples/attachment-sample";
7
+ import { Callout } from "fumadocs-ui/components/callout";
8
+
9
+ ## Overview
10
+
11
+ The Attachment components let the user attach files and view the attachments.
12
+
13
+ <AttachmentSample />
14
+
15
+ <Callout type="info">
16
+ **Note:** These components provide the UI for attachments, but you also need to configure attachment adapters in your runtime to handle file uploads and processing. See the [Attachments Guide](/docs/guides/Attachments) for complete setup instructions.
17
+ </Callout>
18
+
19
+ ## Getting Started
20
+
21
+ <Steps>
22
+ <Step>
23
+
24
+ ### Add `attachment`
25
+
26
+ ```sh
27
+ npx shadcn@latest add "https://r.assistant-ui.com/attachment"
28
+ ```
29
+
30
+ This adds a `/components/assistant-ui/attachment.tsx` file to your project, which you can adjust as needed.
31
+
32
+ </Step>
33
+ <Step>
34
+
35
+ ### Use in your application
36
+
37
+ ```tsx title="/components/assistant-ui/thread.tsx" {1-4,9-10}
38
+ import {
39
+ ComposerAttachments,
40
+ ComposerAddAttachment,
41
+ } from "@/components/assistant-ui/attachment";
42
+
43
+ const Composer: FC = () => {
44
+ return (
45
+ <ComposerPrimitive.Root className="...">
46
+ <ComposerAttachments />
47
+ <ComposerAddAttachment />
48
+
49
+ <ComposerPrimitive.Input
50
+ autoFocus
51
+ placeholder="Write a message..."
52
+ rows={1}
53
+ className="..."
54
+ />
55
+ <ComposerAction />
56
+ </ComposerPrimitive.Root>
57
+ );
58
+ };
59
+ ```
60
+
61
+ ```tsx title="/components/assistant-ui/thread.tsx" {1,8}
62
+ import { UserMessageAttachments } from "@/components/assistant-ui/attachment";
63
+
64
+ const UserMessage: FC = () => {
65
+ return (
66
+ <MessagePrimitive.Root className="...">
67
+ <UserActionBar />
68
+
69
+ <UserMessageAttachments />
70
+
71
+ <div className="...">
72
+ <MessagePrimitive.Content />
73
+ </div>
74
+
75
+ <BranchPicker className="..." />
76
+ </MessagePrimitive.Root>
77
+ );
78
+ };
79
+ ```
80
+
81
+ </Step>
82
+ </Steps>
@@ -0,0 +1,72 @@
1
+ ---
2
+ title: Markdown
3
+ ---
4
+
5
+ Allow the assistant to display rich text using markdown.
6
+
7
+ import { Step, Steps } from "fumadocs-ui/components/steps";
8
+ import { Callout } from "fumadocs-ui/components/callout";
9
+
10
+ <Callout>
11
+ Markdown support is already included by default in the `Thread` component.
12
+ </Callout>
13
+
14
+ ## Enabling markdown support
15
+
16
+ <Steps>
17
+
18
+ <Step>
19
+ ### Add `markdown-text`
20
+
21
+ ```tsx
22
+ npx shadcn@latest add "https://r.assistant-ui.com/markdown-text"
23
+ ```
24
+
25
+ This adds a `/components/assistant-ui/markdown-text.tsx` file to your project, which you can adjust as needed.
26
+
27
+ </Step>
28
+
29
+ <Step>
30
+
31
+ ### Use it in your application
32
+
33
+ Pass the `MarkdownText` component to the `MessagePrimitive.Content` component
34
+
35
+ ```tsx twoslash title="/components/assistant-ui/thread.tsx" {1,11}
36
+ // @filename: /components/assistant-ui/markdown-text.tsx
37
+ import { FC } from "react";
38
+ export const MarkdownText: FC = () => null;
39
+
40
+ // @filename: ./thread.tsx
41
+ import { FC } from "react";
42
+ import { MessagePrimitive } from "@assistant-ui/react";
43
+ import { Avatar, AvatarFallback } from "@/components/ui/avatar";
44
+
45
+ const AssistantActionBar: FC = () => null;
46
+ const BranchPicker: FC<{ className?: string }> = () => null;
47
+
48
+ // ---cut---
49
+ import { MarkdownText } from "@/components/assistant-ui/markdown-text";
50
+
51
+ const AssistantMessage: FC = () => {
52
+ return (
53
+ <MessagePrimitive.Root className="...">
54
+ <div className="...">
55
+ <MessagePrimitive.Content components={{ Text: MarkdownText }} />
56
+ </div>
57
+ <AssistantActionBar />
58
+
59
+ <BranchPicker className="..." />
60
+ </MessagePrimitive.Root>
61
+ );
62
+ };
63
+ ```
64
+
65
+ </Step>
66
+
67
+ </Steps>
68
+
69
+ ## Syntax highlighting
70
+
71
+ Syntax Highlighting is not included by default, see [Syntax Highlighting](/docs/ui/SyntaxHighlighting) to learn how to add it.
72
+
@@ -0,0 +1,79 @@
1
+ ---
2
+ title: "Mermaid Diagrams"
3
+ ---
4
+
5
+ import { Callout } from "fumadocs-ui/components/callout";
6
+ import { Step, Steps } from "fumadocs-ui/components/steps";
7
+
8
+ Render Mermaid diagrams in chat messages with the `mermaid-diagram` component.
9
+
10
+ <Steps>
11
+ <Step>
12
+
13
+ ### Add `mermaid-diagram` component
14
+
15
+ ```bash
16
+ npx shadcn@latest add "https://r.assistant-ui.com/mermaid-diagram"
17
+ ```
18
+
19
+ This will install the required dependencies and add the component to your project.
20
+
21
+ </Step>
22
+ <Step>
23
+
24
+ ### Add it to `componentsByLanguage` in `markdown-text.tsx`
25
+
26
+ ```tsx title="/components/assistant-ui/markdown-text.tsx"
27
+ import { MermaidDiagram } from "@/components/assistant-ui/mermaid-diagram"; // [!code ++]
28
+
29
+ const MarkdownTextImpl = () => {
30
+ return (
31
+ <MarkdownTextPrimitive
32
+ remarkPlugins={[remarkGfm]}
33
+ className="aui-md"
34
+ components={defaultComponents}
35
+ componentsByLanguage={{ // [!code ++]
36
+ mermaid: { // [!code ++]
37
+ SyntaxHighlighter: MermaidDiagram // [!code ++]
38
+ }, // [!code ++]
39
+ }} // [!code ++]
40
+ />
41
+ );
42
+ };
43
+
44
+ export const MarkdownText = memo(MarkdownTextImpl);
45
+ ```
46
+
47
+ </Step>
48
+ </Steps>
49
+
50
+ ## Configuration
51
+
52
+ Configure mermaid options in `mermaid-diagram.tsx`:
53
+
54
+ ```tsx title="/components/assistant-ui/mermaid-diagram.tsx"
55
+ mermaid.initialize({ theme: "default" });
56
+ ```
57
+
58
+ ## Streaming Performance
59
+
60
+ The `MermaidDiagram` component is optimized for streaming scenarios:
61
+
62
+ - **Smart completion detection**: Only renders when the specific code block is complete
63
+ - **Zero failed renders**: Avoids parsing incomplete diagram code during streaming
64
+
65
+
66
+ ## Supported Diagram Types
67
+
68
+ Mermaid supports various diagram types including:
69
+
70
+ - Flowcharts and decision trees
71
+ - Sequence diagrams
72
+ - Gantt charts
73
+ - Class diagrams
74
+ - State diagrams
75
+ - Git graphs
76
+ - User journey maps
77
+ - Entity relationship diagrams
78
+
79
+ See the [Mermaid documentation](https://mermaid.js.org/) for complete syntax reference.
@@ -0,0 +1,59 @@
1
+ ---
2
+ title: Custom Scrollbar
3
+ ---
4
+
5
+ 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`.
6
+ An example implementation of this is [shadcn/ui's Scroll Area](https://ui.shadcn.com/docs/components/scroll-area).
7
+
8
+ ## Add shadcn Scroll Area
9
+
10
+ ```sh
11
+ npx shadcn@latest add scroll-area
12
+ ```
13
+
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
+ ```sh
19
+ pnpm add @radix-ui/react-scroll-area@next
20
+ ```
21
+
22
+ ## Additional Styles
23
+
24
+ The Radix UI Viewport component adds an intermediate `<div data-radix-scroll-area-content>` element.
25
+ Add the following CSS to your `globals.css`:
26
+
27
+ ```css title="@/app/globals.css"
28
+ .thread-viewport > [data-radix-scroll-area-content] {
29
+ @apply flex flex-col items-center self-stretch bg-inherit;
30
+ }
31
+ ```
32
+
33
+ ## Integration
34
+
35
+ - Wrap `Thread.Root` with `<ScrollAreaPrimitive.Root asChild>`
36
+ - Wrap `Thread.Viewport` with `<ScrollAreaPrimitive.Viewport className="thread-viewport" asChild>`
37
+ - Add shadcn's `<ScrollBar />` to `Thread.Root`
38
+
39
+ The resulting MyThread component should look like this:
40
+
41
+ ```tsx {1-2,6,8,12-13,15}
42
+ import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
43
+ import { ScrollBar } from "@/components/ui/scroll-area";
44
+
45
+ const MyThread: FC = () => {
46
+ return (
47
+ <ScrollAreaPrimitive.Root asChild>
48
+ <ThreadPrimitive.Root className="...">
49
+ <ScrollAreaPrimitive.Viewport className="thread-viewport" asChild>
50
+ <ThreadPrimitive.Viewport className="...">
51
+ ...
52
+ </ThreadPrimitive.Viewport>
53
+ </ScrollAreaPrimitive.Viewport>
54
+ <ScrollBar />
55
+ </ThreadPrimitive.Root>
56
+ </ScrollAreaPrimitive.Root>
57
+ );
58
+ };
59
+ ```
@@ -0,0 +1,253 @@
1
+ ---
2
+ title: Syntax Highlighting
3
+ ---
4
+
5
+ import { Steps, Step } from "fumadocs-ui/components/steps";
6
+ import { Callout } from "fumadocs-ui/components/callout";
7
+ import { TypeTable } from "fumadocs-ui/components/type-table";
8
+
9
+ Syntax highlighting for code blocks in markdown.
10
+
11
+ <Callout type="warn">Syntax highlighting is not enabled in markdown by default.</Callout>
12
+
13
+ <Callout type="info">
14
+ `assistant-ui` provides two options for syntax highlighting:
15
+ - **react-shiki** (recommended for performance & dynamic language support)
16
+ - **react-syntax-highlighter** (legacy - Prism or Highlight.js based)
17
+ </Callout>
18
+
19
+ ---
20
+
21
+ ## react-shiki
22
+
23
+ <Steps>
24
+ <Step>
25
+
26
+ #### Add `shiki-highlighter`
27
+
28
+ ```bash
29
+ npx shadcn@latest add "https://r.assistant-ui.com/shiki-highlighter"
30
+ ```
31
+
32
+ This adds a `/components/assistant-ui/shiki-highlighter.tsx` file to your project and
33
+ installs the `react-shiki` dependency. The highlighter can be customized by editing
34
+ the config in the `shiki-highlighter.tsx` file.
35
+
36
+ </Step>
37
+ <Step>
38
+
39
+ #### Add it to `defaultComponents` in `markdown-text.tsx`
40
+
41
+ ```tsx title="/components/assistant-ui/markdown-text.tsx"
42
+ import { SyntaxHighlighter } from "./shiki-highlighter";
43
+
44
+ export const defaultComponents = memoizeMarkdownComponents({
45
+ SyntaxHighlighter: SyntaxHighlighter, // [!code ++]
46
+ h1: /* ... */,
47
+ // ...other elements...
48
+ });
49
+ ```
50
+
51
+ </Step>
52
+ </Steps>
53
+
54
+ ### Options
55
+
56
+ <TypeTable
57
+ type={Object.fromEntries(
58
+ Object.entries({
59
+ theme: {
60
+ description:
61
+ "Shiki built-in or custom textmate themes. Accepts a single theme or an object of themes mapped to theme mode strings.",
62
+ type: "Theme | Themes",
63
+ typeDescriptionLink:
64
+ "https://github.com/AVGVSTVS96/react-shiki/blob/694433ef697c9791b3816cf94d12d571e8abbb3a/package/src/types.ts#L51",
65
+ default: "github-dark",
66
+ required: true,
67
+ },
68
+ language: {
69
+ description:
70
+ "Shiki built-in or custom textmate grammar object for highlighting",
71
+ type: "Language (string | object)",
72
+ typeDescriptionLink:
73
+ "https://github.com/AVGVSTVS96/react-shiki/blob/694433ef697c9791b3816cf94d12d571e8abbb3a/package/src/types.ts#L24",
74
+ default: "text",
75
+ required: true,
76
+ },
77
+ as: {
78
+ description: "The code block container element type",
79
+ type: "React.ElementType",
80
+ default: "pre",
81
+ },
82
+ className: {
83
+ description: "Custom CSS classes for the code block container element",
84
+ type: "string",
85
+ default: "",
86
+ },
87
+ style: {
88
+ description: "Inline styles for the code block container element",
89
+ type: "React.CSSProperties",
90
+ default: undefined,
91
+ },
92
+ delay: {
93
+ description:
94
+ "Delay in milliseconds between consecutive highlights, useful for streamed code responses.",
95
+ type: "number",
96
+ default: 0,
97
+ },
98
+ customLanguages: {
99
+ description: "Custom languages to preload for highlighting",
100
+ type: "Language[]",
101
+ typeDescriptionLink:
102
+ "https://github.com/AVGVSTVS96/react-shiki/blob/694433ef697c9791b3816cf94d12d571e8abbb3a/package/src/types.ts#L24",
103
+ default: "",
104
+ },
105
+ codeToHastOptions: {
106
+ description: "All other options supported by Shiki's `codeToHast`",
107
+ type: "CodeToHastOptions",
108
+ typeDescriptionLink:
109
+ "https://github.com/shikijs/shiki/blob/main/packages/types/src/options.ts#L121",
110
+ default: "{}",
111
+ required: true,
112
+ },
113
+ // This reverts the order of the type table, fumadocs reversed the order on 4/22/25 in:
114
+ // https://github.com/fuma-nama/fumadocs/commit/3a5595aa65acfa5c20be2377d09c03fbb1de72a6
115
+ }).reverse(),
116
+ )}
117
+ />
118
+
119
+ ### Bundle Optimization
120
+
121
+ By default, `react-shiki` includes the full Shiki bundle, which contains all supported languages and themes.
122
+
123
+ To reduce bundle size, you can use the web bundle by changing the import to `react-shiki/web`, to include a smaller bundle of web related languages:
124
+
125
+ ```tsx title="/components/assistant-ui/shiki-highlighter.tsx"
126
+ import ShikiHighlighter, { type ShikiHighlighterProps } from "react-shiki/web";
127
+ ```
128
+
129
+ #### Custom Bundles
130
+
131
+ For strict bundle size control, `react-shiki` also supports custom bundles created using `createHighlighterCore` from `react-shiki/core` (re-exported from Shiki):
132
+
133
+ ```tsx title="/components/assistant-ui/shiki-highlighter.tsx" {3-9}
134
+ import { createHighlighterCore, createOnigurumaEngine } from "react-shiki/core"; // [!code ++]
135
+
136
+ // Create the highlighter
137
+ // Use dynamic imports to load languages and themes on client on demand
138
+ const customHighlighter = await createHighlighterCore({
139
+ themes: [import("@shikijs/themes/nord")],
140
+ langs: [
141
+ import("@shikijs/langs/javascript"),
142
+ import("@shikijs/langs/typescript"),
143
+ ],
144
+ engine: createOnigurumaEngine(import("shiki/wasm")),
145
+ });
146
+
147
+ // Then pass it to the highlighter prop
148
+ <SyntaxHighlighter
149
+ {...props}
150
+ language={language}
151
+ theme={theme}
152
+ highlighter={customHighlighter} // [!code ++]
153
+ />;
154
+ ```
155
+
156
+ <Callout type="info">
157
+ For more information, see [react-shiki - bundle options](https://github.com/avgvstvs96/react-shiki#bundle-options).
158
+ </Callout>
159
+
160
+ ### Dual/multi theme support
161
+
162
+ To use multiple theme modes, pass an object with your multi-theme configuration to the `theme` prop in the `ShikiHighlighter` component:
163
+
164
+ ```tsx title="/components/assistant-ui/shiki-highlighter.tsx"
165
+ <ShikiHighlighter
166
+ /* ... */
167
+ theme={{
168
+ light: "github-light",
169
+ dark: "github-dark",
170
+ }}
171
+ /* ... */
172
+ >
173
+ ```
174
+
175
+ To make themes responsive to your site's theme mode, add one of the following CSS snippets to your project:
176
+
177
+ ```css title="shiki.css"
178
+ /* for class based dark mode */
179
+ html.dark .shiki,
180
+ html.dark .shiki span {
181
+ color: var(--shiki-dark) !important;
182
+ background-color: var(--shiki-dark-bg) !important;
183
+ /* Optional, if you also want font styles */
184
+ font-style: var(--shiki-dark-font-style) !important;
185
+ font-weight: var(--shiki-dark-font-weight) !important;
186
+ text-decoration: var(--shiki-dark-text-decoration) !important;
187
+ }
188
+
189
+ /* for query based dark mode */
190
+ @media (prefers-color-scheme: dark) {
191
+ .shiki,
192
+ .shiki span {
193
+ color: var(--shiki-dark) !important;
194
+ background-color: var(--shiki-dark-bg) !important;
195
+ /* Optional, if you also want font styles */
196
+ font-style: var(--shiki-dark-font-style) !important;
197
+ font-weight: var(--shiki-dark-font-weight) !important;
198
+ text-decoration: var(--shiki-dark-text-decoration) !important;
199
+ }
200
+ }
201
+ ```
202
+
203
+ For more information, see [Shiki's documentation on dual and multi themes](https://shiki.style/guide/dual-themes).
204
+
205
+ ---
206
+
207
+ ## react-syntax-highlighter
208
+
209
+ <Callout type="warn">
210
+ This option may be removed in a future release. Consider using
211
+ [react-shiki](#react-shiki) instead.
212
+ </Callout>
213
+
214
+ <Steps>
215
+ <Step>
216
+
217
+ #### Add `syntax-highlighter`
218
+
219
+ ```bash
220
+ npx shadcn@latest add "https://r.assistant-ui.com/syntax-highlighter"
221
+ ```
222
+
223
+ Adds a `/components/assistant-ui/syntax-highlighter.tsx` file to your project and installs the `react-syntax-highlighter` dependency.
224
+
225
+ </Step>
226
+ <Step>
227
+
228
+ #### Add it to `defaultComponents` in `markdown-text.tsx`
229
+
230
+ ```tsx title="/components/assistant-ui/markdown-text.tsx"
231
+ import { SyntaxHighlighter } from "./syntax-highlighter";
232
+
233
+ export const defaultComponents = memoizeMarkdownComponents({
234
+ SyntaxHighlighter: SyntaxHighlighter, // [!code ++]
235
+ h1: /* ... */,
236
+ // ...other elements...
237
+ });
238
+ ```
239
+
240
+ </Step>
241
+ </Steps>
242
+
243
+ ### Options
244
+
245
+ Supports all options from [`react-syntax-highlighter`](https://github.com/react-syntax-highlighter/react-syntax-highlighter#props).
246
+
247
+ ### Bundle Optimization
248
+
249
+ By default, the syntax highlighter uses a light build that only includes languages you register. To include all languages:
250
+
251
+ ```tsx title="/components/assistant-ui/syntax-highlighter.tsx"
252
+ import { makePrismAsyncSyntaxHighlighter } from "@assistant-ui/react-syntax-highlighter/full";
253
+ ```
@@ -0,0 +1,47 @@
1
+ ---
2
+ title: Thread
3
+ ---
4
+
5
+ import { Steps, Step } from "fumadocs-ui/components/steps";
6
+ import { Callout } from "fumadocs-ui/components/callout";
7
+ import { ThreadSample } from "../../../components/samples/thread-sample";
8
+
9
+
10
+ ## Overview
11
+
12
+ The raw message list and message composer UI.
13
+
14
+ <ThreadSample />
15
+
16
+ ## Getting Started
17
+
18
+ <Steps>
19
+ <Step>
20
+
21
+ ### Add `thread`
22
+
23
+ ```sh
24
+ npx shadcn@latest add "https://r.assistant-ui.com/thread"
25
+ ```
26
+
27
+ This adds a `/components/assistant-ui/thread.tsx` file to your project, which you can adjust as needed.
28
+
29
+ </Step>
30
+ <Step>
31
+
32
+ ### Use in your application
33
+
34
+ ```tsx title="/app/page.tsx" {1,6}
35
+ import { Thread } from "@/components/assistant-ui/thread";
36
+
37
+ export default function Home() {
38
+ return (
39
+ <div className="h-full">
40
+ <Thread />
41
+ </div>
42
+ );
43
+ }
44
+ ```
45
+
46
+ </Step>
47
+ </Steps>