@assistant-ui/mcp-docs-server 0.2.1 → 0.2.3

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 (187) hide show
  1. package/.docs/organized/code-examples/waterfall.md +3 -3
  2. package/.docs/organized/code-examples/with-a2a.md +5 -4
  3. package/.docs/organized/code-examples/with-ag-ui.md +7 -6
  4. package/.docs/organized/code-examples/with-ai-sdk-v7.md +14 -13
  5. package/.docs/organized/code-examples/with-artifacts.md +12 -11
  6. package/.docs/organized/code-examples/with-assistant-transport.md +6 -5
  7. package/.docs/organized/code-examples/with-browser-extension.md +6 -6
  8. package/.docs/organized/code-examples/with-chain-of-thought.md +16 -14
  9. package/.docs/organized/code-examples/with-cloud-standalone.md +7 -7
  10. package/.docs/organized/code-examples/with-cloud.md +11 -10
  11. package/.docs/organized/code-examples/with-custom-thread-list.md +11 -10
  12. package/.docs/organized/code-examples/with-elevenlabs-conversational.md +14 -13
  13. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +15 -14
  14. package/.docs/organized/code-examples/with-eve.md +6 -5
  15. package/.docs/organized/code-examples/with-expo.md +213 -36
  16. package/.docs/organized/code-examples/with-external-store.md +6 -5
  17. package/.docs/organized/code-examples/with-ffmpeg.md +11 -10
  18. package/.docs/organized/code-examples/with-generative-ui.md +263 -29
  19. package/.docs/organized/code-examples/with-google-adk.md +5 -4
  20. package/.docs/organized/code-examples/with-heat-graph.md +3 -3
  21. package/.docs/organized/code-examples/with-image-generation.md +8 -7
  22. package/.docs/organized/code-examples/with-interactables.md +11 -10
  23. package/.docs/organized/code-examples/with-langchain.md +10 -9
  24. package/.docs/organized/code-examples/with-langgraph.md +7 -6
  25. package/.docs/organized/code-examples/with-livekit.md +15 -14
  26. package/.docs/organized/code-examples/with-mcp.md +14 -12
  27. package/.docs/organized/code-examples/with-nuxt.md +511 -575
  28. package/.docs/organized/code-examples/with-opencode.md +4 -4
  29. package/.docs/organized/code-examples/with-openui.md +450 -0
  30. package/.docs/organized/code-examples/with-pi.md +6 -5
  31. package/.docs/organized/code-examples/with-react-hook-form.md +16 -13
  32. package/.docs/organized/code-examples/with-react-ink-web.md +65 -15
  33. package/.docs/organized/code-examples/with-react-ink.md +5 -4
  34. package/.docs/organized/code-examples/with-react-router.md +8 -7
  35. package/.docs/organized/code-examples/with-resumable-stream.md +13 -12
  36. package/.docs/organized/code-examples/with-store.md +3 -3
  37. package/.docs/organized/code-examples/with-svelte.md +415 -0
  38. package/.docs/organized/code-examples/with-sveltekit.md +1061 -0
  39. package/.docs/organized/code-examples/with-tanstack.md +10 -9
  40. package/.docs/organized/code-examples/with-tap-runtime.md +5 -4
  41. package/.docs/organized/code-examples/with-virtualized-thread.md +6 -5
  42. package/.docs/organized/code-examples/with-vue.md +2 -2
  43. package/.docs/raw/docs/{(docs) → (getting-started)}/cli.mdx +6 -1
  44. package/.docs/raw/docs/{(docs) → (getting-started)}/devtools.mdx +1 -1
  45. package/.docs/raw/docs/{(docs) → (getting-started)}/index.mdx +4 -2
  46. package/.docs/raw/docs/{(docs) → (getting-started)}/installation.mdx +26 -26
  47. package/.docs/raw/docs/(reference)/api-reference/adapters/suggestions.mdx +6 -0
  48. package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +1 -1
  49. package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +6 -1
  50. package/.docs/raw/docs/(reference)/api-reference/generative-ui/slack.mdx +5 -1
  51. package/.docs/raw/docs/(reference)/api-reference/generative-ui/teams.mdx +9 -2
  52. package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +2 -2
  53. package/.docs/raw/docs/(reference)/api-reference/integrations/{react-ai-sdk.mdx → ai-sdk.mdx} +43 -18
  54. package/.docs/raw/docs/(reference)/api-reference/integrations/eve.mdx +61 -2
  55. package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +3 -3
  56. package/.docs/raw/docs/(reference)/api-reference/overview.mdx +2 -2
  57. package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +20 -2
  58. package/.docs/raw/docs/(reference)/api-reference/tools/interactables.mdx +1 -1
  59. package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +1 -1
  60. package/.docs/raw/docs/(reference)/api-reference/transport/frame.mdx +1 -1
  61. package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +32 -1
  62. package/.docs/raw/docs/(reference)/api-reference/voice/session.mdx +1 -1
  63. package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +10 -10
  64. package/.docs/raw/docs/cloud/ai-sdk.mdx +4 -2
  65. package/.docs/raw/docs/cloud/index.mdx +1 -1
  66. package/.docs/raw/docs/copilots/assistant-frame.mdx +19 -8
  67. package/.docs/raw/docs/guides/attachments.mdx +4 -4
  68. package/.docs/raw/docs/guides/branching.mdx +1 -1
  69. package/.docs/raw/docs/guides/chatgpt-subscription.mdx +1 -1
  70. package/.docs/raw/docs/guides/context-api.mdx +15 -17
  71. package/.docs/raw/docs/guides/dictation.mdx +2 -2
  72. package/.docs/raw/docs/guides/electron.mdx +1 -1
  73. package/.docs/raw/docs/guides/latex.mdx +1 -1
  74. package/.docs/raw/docs/guides/mentions.mdx +2 -0
  75. package/.docs/raw/docs/guides/message-timing.mdx +11 -5
  76. package/.docs/raw/docs/guides/quoting.mdx +1 -1
  77. package/.docs/raw/docs/guides/resumable-streams.mdx +3 -3
  78. package/.docs/raw/docs/guides/speech.mdx +1 -1
  79. package/.docs/raw/docs/guides/suggestions.mdx +8 -5
  80. package/.docs/raw/docs/guides/voice.mdx +1 -1
  81. package/.docs/raw/docs/ink/hooks.mdx +1 -1
  82. package/.docs/raw/docs/ink/index.mdx +3 -2
  83. package/.docs/raw/docs/ink/migration.mdx +1 -1
  84. package/.docs/raw/docs/ink/primitives.mdx +1 -1
  85. package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +3 -3
  86. package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +3 -3
  87. package/.docs/raw/docs/integrations/frameworks/{cloudflare-agents/overview.mdx → cloudflare-agents.mdx} +4 -3
  88. package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +1 -1
  89. package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +1 -1
  90. package/.docs/raw/docs/integrations/index.mdx +2 -2
  91. package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +149 -131
  92. package/.docs/raw/docs/migrations/toolkit-tools.mdx +2 -2
  93. package/.docs/raw/docs/migrations/v0-15.mdx +34 -0
  94. package/.docs/raw/docs/primitives/action-bar.mdx +1 -1
  95. package/.docs/raw/docs/primitives/assistant-modal.mdx +1 -1
  96. package/.docs/raw/docs/primitives/attachment.mdx +1 -1
  97. package/.docs/raw/docs/primitives/branch-picker.mdx +1 -1
  98. package/.docs/raw/docs/primitives/chain-of-thought.mdx +3 -3
  99. package/.docs/raw/docs/primitives/composer.mdx +1 -1
  100. package/.docs/raw/docs/primitives/error.mdx +1 -1
  101. package/.docs/raw/docs/primitives/message.mdx +1 -1
  102. package/.docs/raw/docs/primitives/selection-toolbar.mdx +1 -1
  103. package/.docs/raw/docs/primitives/suggestion.mdx +4 -2
  104. package/.docs/raw/docs/primitives/thread-list.mdx +1 -1
  105. package/.docs/raw/docs/primitives/thread.mdx +2 -2
  106. package/.docs/raw/docs/react-native/adapters.mdx +1 -1
  107. package/.docs/raw/docs/react-native/index.mdx +2 -2
  108. package/.docs/raw/docs/react-native/migration.mdx +2 -2
  109. package/.docs/raw/docs/react-native/primitives.mdx +142 -5
  110. package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +48 -6
  111. package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +3 -3
  112. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +4 -4
  113. package/.docs/raw/docs/runtimes/ai-sdk/v7.mdx +31 -16
  114. package/.docs/raw/docs/runtimes/claude-managed-agents.mdx +118 -0
  115. package/.docs/raw/docs/runtimes/concepts/adapters.mdx +3 -3
  116. package/.docs/raw/docs/runtimes/concepts/architecture.mdx +3 -3
  117. package/.docs/raw/docs/runtimes/concepts/stability.mdx +2 -1
  118. package/.docs/raw/docs/runtimes/concepts/threads.mdx +73 -33
  119. package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +1 -1
  120. package/.docs/raw/docs/runtimes/custom/external-store.mdx +6 -2
  121. package/.docs/raw/docs/runtimes/langchain.mdx +2 -2
  122. package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +4 -0
  123. package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +1 -1
  124. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +9 -2
  125. package/.docs/raw/docs/tools/backend.mdx +4 -4
  126. package/.docs/raw/docs/tools/defining-tools.mdx +21 -2
  127. package/.docs/raw/docs/tools/generative-ui-primitive.mdx +180 -0
  128. package/.docs/raw/docs/tools/generative-ui-slack.mdx +167 -0
  129. package/.docs/raw/docs/tools/generative-ui-teams.mdx +160 -0
  130. package/.docs/raw/docs/tools/generative-ui.mdx +224 -211
  131. package/.docs/raw/docs/tools/index.mdx +2 -1
  132. package/.docs/raw/docs/tools/interactables.mdx +8 -7
  133. package/.docs/raw/docs/tools/mcp-apps.mdx +18 -1
  134. package/.docs/raw/docs/tools/mcp.mdx +2 -2
  135. package/.docs/raw/docs/tools/openui.mdx +175 -0
  136. package/.docs/raw/docs/tools/tool-ui.mdx +18 -7
  137. package/.docs/raw/docs/tools/user-managed-mcp.mdx +7 -3
  138. package/.docs/raw/docs/ui/assistant-modal.mdx +3 -3
  139. package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -1
  140. package/.docs/raw/docs/ui/attachment.mdx +50 -3
  141. package/.docs/raw/docs/ui/composer-trigger-popover.mdx +36 -1
  142. package/.docs/raw/docs/ui/context-display.mdx +1 -1
  143. package/.docs/raw/docs/ui/directive-text.mdx +1 -1
  144. package/.docs/raw/docs/ui/file.mdx +2 -2
  145. package/.docs/raw/docs/ui/follow-up-suggestions.mdx +1 -1
  146. package/.docs/raw/docs/ui/image.mdx +2 -2
  147. package/.docs/raw/docs/ui/markdown.mdx +40 -1
  148. package/.docs/raw/docs/ui/mermaid.mdx +1 -1
  149. package/.docs/raw/docs/ui/message-timing.mdx +1 -1
  150. package/.docs/raw/docs/ui/model-selector.mdx +4 -4
  151. package/.docs/raw/docs/ui/part-grouping.mdx +1 -1
  152. package/.docs/raw/docs/ui/quote.mdx +3 -3
  153. package/.docs/raw/docs/ui/reasoning.mdx +31 -3
  154. package/.docs/raw/docs/ui/scrollbar.mdx +1 -1
  155. package/.docs/raw/docs/ui/sources.mdx +10 -1
  156. package/.docs/raw/docs/ui/streamdown.mdx +2 -2
  157. package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -1
  158. package/.docs/raw/docs/ui/thread-list.mdx +40 -1
  159. package/.docs/raw/docs/ui/thread.mdx +49 -2
  160. package/.docs/raw/docs/ui/tool-fallback.mdx +23 -9
  161. package/.docs/raw/docs/ui/tool-group.mdx +1 -1
  162. package/.docs/raw/docs/ui/voice.mdx +1 -1
  163. package/.docs/raw/docs/utilities/react-o11y.mdx +2 -2
  164. package/dist/xulux/catalog-client.d.ts.map +1 -1
  165. package/dist/xulux/catalog-client.js +51 -6
  166. package/dist/xulux/catalog-client.js.map +1 -1
  167. package/dist/xulux/types.d.ts +7 -7
  168. package/dist/xulux/types.d.ts.map +1 -1
  169. package/dist/xulux/types.js.map +1 -1
  170. package/package.json +5 -5
  171. package/src/tools/tests/docs.test.ts +10 -7
  172. package/src/tools/tests/path-traversal.test.ts +5 -2
  173. package/src/tools/tests/xulux-templates.test.ts +63 -0
  174. package/src/xulux/catalog-client.ts +68 -23
  175. package/src/xulux/types.ts +17 -13
  176. package/.docs/raw/docs/tools/interactables-legacy.mdx +0 -423
  177. package/.docs/raw/docs/ui/accordion.mdx +0 -266
  178. package/.docs/raw/docs/ui/badge.mdx +0 -150
  179. package/.docs/raw/docs/ui/diff-viewer.mdx +0 -280
  180. package/.docs/raw/docs/ui/dot-matrix.mdx +0 -133
  181. package/.docs/raw/docs/ui/number-roll.mdx +0 -154
  182. package/.docs/raw/docs/ui/select.mdx +0 -254
  183. package/.docs/raw/docs/ui/tabs.mdx +0 -271
  184. /package/.docs/raw/docs/{(docs) → (getting-started)}/architecture.mdx +0 -0
  185. /package/.docs/raw/docs/{(docs) → (getting-started)}/base-ui.mdx +0 -0
  186. /package/.docs/raw/docs/{(docs) → (getting-started)}/llm.mdx +0 -0
  187. /package/.docs/raw/docs/{(docs) → (getting-started)}/rtl.mdx +0 -0
@@ -1,266 +0,0 @@
1
- ---
2
- title: Accordion
3
- description: A vertically stacked set of interactive headings that reveal or hide content sections.
4
- links:
5
- - label: Radix UI Accordion (Radix styles)
6
- url: https://www.radix-ui.com/primitives/docs/components/accordion
7
- - label: Base UI Accordion (base styles)
8
- url: https://base-ui.com/react/components/accordion
9
- platforms: ["react"]
10
- ---
11
-
12
- import { PreviewCode } from "@/components/docs/preview-code.server";
13
- import {
14
- AccordionSample,
15
- AccordionVariantsSample,
16
- AccordionMultipleSample,
17
- AccordionWithIconsSample,
18
- AccordionControlledSample,
19
- AccordionFAQSample,
20
- } from "@/components/docs/samples/accordion";
21
- import * as AccordionRadixSamples from "@/components/docs/samples/accordion.radix";
22
- import { Flavored, FlavorSwitcher } from "@/components/docs/contexts/flavor.server";
23
-
24
- <Callout>
25
- This is a **standalone component** that does not depend on the assistant-ui runtime. Use it anywhere in your application.
26
- </Callout>
27
-
28
- <FlavorSwitcher />
29
-
30
- <Flavored radix={<AccordionRadixSamples.AccordionSample />} base={<AccordionSample />} />
31
-
32
- ## Installation
33
-
34
- <InstallCommand shadcn={["accordion"]} />
35
-
36
- ## Usage
37
-
38
- ```tsx
39
- import {
40
- Accordion,
41
- AccordionItem,
42
- AccordionTrigger,
43
- AccordionContent,
44
- } from "@/components/assistant-ui/accordion";
45
-
46
- export function Example() {
47
- return (
48
- <Accordion type="single" collapsible>
49
- <AccordionItem value="item-1">
50
- <AccordionTrigger>Section 1</AccordionTrigger>
51
- <AccordionContent>Content for section 1.</AccordionContent>
52
- </AccordionItem>
53
- <AccordionItem value="item-2">
54
- <AccordionTrigger>Section 2</AccordionTrigger>
55
- <AccordionContent>Content for section 2.</AccordionContent>
56
- </AccordionItem>
57
- </Accordion>
58
- );
59
- }
60
- ```
61
-
62
- ## Examples
63
-
64
- ### Variants
65
-
66
- Use the `variant` prop on `Accordion` to change the visual style. Child components inherit the variant automatically.
67
-
68
- <Flavored radix={<AccordionRadixSamples.AccordionVariantsSample />} base={<AccordionVariantsSample />} />
69
-
70
- ```tsx
71
- // Default - border-bottom separator
72
- <Accordion type="single" collapsible variant="default">
73
- <AccordionItem value="item-1">
74
- <AccordionTrigger>...</AccordionTrigger>
75
- <AccordionContent>...</AccordionContent>
76
- </AccordionItem>
77
- </Accordion>
78
-
79
- // Outline - bordered container
80
- <Accordion type="single" collapsible variant="outline">
81
- <AccordionItem value="item-1">
82
- <AccordionTrigger>...</AccordionTrigger>
83
- <AccordionContent>...</AccordionContent>
84
- </AccordionItem>
85
- </Accordion>
86
-
87
- // Ghost - separated cards
88
- <Accordion type="single" collapsible variant="ghost">
89
- <AccordionItem value="item-1">
90
- <AccordionTrigger>...</AccordionTrigger>
91
- <AccordionContent>...</AccordionContent>
92
- </AccordionItem>
93
- </Accordion>
94
- ```
95
-
96
- ### Multiple Items Open
97
-
98
- Use `type="multiple"` to allow multiple items to be open simultaneously.
99
-
100
- <Flavored radix={<AccordionRadixSamples.AccordionMultipleSample />} base={<AccordionMultipleSample />} />
101
-
102
- ```tsx
103
- <Accordion type="multiple">
104
- <AccordionItem value="item-1">
105
- <AccordionTrigger>First Section</AccordionTrigger>
106
- <AccordionContent>Content 1</AccordionContent>
107
- </AccordionItem>
108
- <AccordionItem value="item-2">
109
- <AccordionTrigger>Second Section</AccordionTrigger>
110
- <AccordionContent>Content 2</AccordionContent>
111
- </AccordionItem>
112
- </Accordion>
113
- ```
114
-
115
- ### With Icons
116
-
117
- Add icons or custom elements inside the trigger.
118
-
119
- <PreviewCode file="components/docs/samples/accordion" name="AccordionWithIconsSample" base={<AccordionWithIconsSample />}>
120
- <AccordionRadixSamples.AccordionWithIconsSample />
121
- </PreviewCode>
122
-
123
- ### Controlled
124
-
125
- Use `value` and `onValueChange` for controlled accordion state.
126
-
127
- <PreviewCode file="components/docs/samples/accordion" name="AccordionControlledSample" base={<AccordionControlledSample />}>
128
- <AccordionRadixSamples.AccordionControlledSample />
129
- </PreviewCode>
130
-
131
- ### FAQ Section
132
-
133
- A practical example of using accordion for a FAQ section.
134
-
135
- <PreviewCode file="components/docs/samples/accordion" name="AccordionFAQSample" base={<AccordionFAQSample />}>
136
- <AccordionRadixSamples.AccordionFAQSample />
137
- </PreviewCode>
138
-
139
- ## API Reference
140
-
141
- ### Composable API
142
-
143
- | Component | Description |
144
- |-----------|-------------|
145
- | `Accordion` | The root component that manages accordion state and variant. |
146
- | `AccordionItem` | A single collapsible section container. |
147
- | `AccordionTrigger` | The clickable header that toggles content visibility. |
148
- | `AccordionContent` | The collapsible content panel. |
149
-
150
- ### Accordion
151
-
152
- The root component that manages accordion state. Set `variant` here to style all child components.
153
-
154
- <ParametersTable
155
- type="AccordionProps"
156
- parameters={[
157
- {
158
- name: "type",
159
- type: '"single" | "multiple"',
160
- required: true,
161
- description: "Whether only one or multiple items can be open at once.",
162
- },
163
- {
164
- name: "collapsible",
165
- type: "boolean",
166
- default: "false",
167
- description: "When type is 'single', allows closing the open item by clicking it again.",
168
- },
169
- {
170
- name: "defaultValue",
171
- type: "string | string[]",
172
- description: "The default open item(s) (uncontrolled).",
173
- },
174
- {
175
- name: "value",
176
- type: "string | string[]",
177
- description: "The controlled open item(s).",
178
- },
179
- {
180
- name: "onValueChange",
181
- type: "(value: string | string[]) => void",
182
- description: "Callback when the open item(s) change.",
183
- },
184
- {
185
- name: "variant",
186
- type: '"default" | "outline" | "ghost"',
187
- default: '"default"',
188
- description: "The visual style of the accordion. Child components inherit this automatically.",
189
- },
190
- {
191
- name: "className",
192
- type: "string",
193
- description: "Additional CSS classes.",
194
- },
195
- ]}
196
- />
197
-
198
- ### AccordionItem
199
-
200
- A single collapsible section container.
201
-
202
- <ParametersTable
203
- type="AccordionItemProps"
204
- parameters={[
205
- {
206
- name: "value",
207
- type: "string",
208
- required: true,
209
- description: "A unique identifier for this item.",
210
- },
211
- {
212
- name: "disabled",
213
- type: "boolean",
214
- description: "Whether the item is disabled.",
215
- },
216
- {
217
- name: "className",
218
- type: "string",
219
- description: "Additional CSS classes.",
220
- },
221
- ]}
222
- />
223
-
224
- ### AccordionTrigger
225
-
226
- The clickable header that toggles content visibility.
227
-
228
- <ParametersTable
229
- type="AccordionTriggerProps"
230
- parameters={[
231
- {
232
- name: "className",
233
- type: "string",
234
- description: "Additional CSS classes.",
235
- },
236
- ]}
237
- />
238
-
239
- ### AccordionContent
240
-
241
- The collapsible content panel.
242
-
243
- <ParametersTable
244
- type="AccordionContentProps"
245
- parameters={[
246
- {
247
- name: "className",
248
- type: "string",
249
- description: "Additional CSS classes.",
250
- },
251
- ]}
252
- />
253
-
254
- ### Style Variants (CVA)
255
-
256
- | Export | Description |
257
- |--------|-------------|
258
- | `accordionVariants` | Styles for the accordion container. |
259
-
260
- ```tsx
261
- import { accordionVariants } from "@/components/assistant-ui/accordion";
262
-
263
- <div className={accordionVariants({ variant: "outline" })}>
264
- Custom Accordion Container
265
- </div>
266
- ```
@@ -1,150 +0,0 @@
1
- ---
2
- title: Badge
3
- description: A small label component for displaying status, categories, or metadata.
4
- links:
5
- - label: Radix UI Slot (Radix styles)
6
- url: https://www.radix-ui.com/primitives/docs/utilities/slot
7
- - label: Base UI useRender (base styles)
8
- url: https://base-ui.com/react/utils/use-render
9
- platforms: ["react"]
10
- ---
11
-
12
- import { PreviewCode } from "@/components/docs/preview-code.server";
13
- import {
14
- BadgeSample,
15
- BadgeSizesSample,
16
- BadgeWithIconSample,
17
- BadgeAsLinkSample,
18
- BadgeAnimatedSample,
19
- } from "@/components/docs/samples/badge";
20
- import * as BadgeRadixSamples from "@/components/docs/samples/badge.radix";
21
- import { Flavored, FlavorSwitcher } from "@/components/docs/contexts/flavor.server";
22
-
23
- <Callout>
24
- This is a **standalone component** that does not depend on the assistant-ui runtime. Use it anywhere in your application.
25
- </Callout>
26
-
27
- <FlavorSwitcher />
28
-
29
- <Flavored radix={<BadgeRadixSamples.BadgeSample />} base={<BadgeSample />} />
30
-
31
- ## Installation
32
-
33
- <InstallCommand shadcn={["badge"]} />
34
-
35
- ## Usage
36
-
37
- ```tsx
38
- import { Badge } from "@/components/assistant-ui/badge";
39
-
40
- export function Example() {
41
- return <Badge>Label</Badge>;
42
- }
43
- ```
44
-
45
- ## Examples
46
-
47
- ### Variants
48
-
49
- Use the `variant` prop to change the visual style.
50
-
51
- <Flavored radix={<BadgeRadixSamples.BadgeSample />} base={<BadgeSample />} />
52
-
53
- ```tsx
54
- <Badge variant="outline" /> // Border (default)
55
- <Badge variant="secondary" /> // Secondary background
56
- <Badge variant="muted" /> // Muted background
57
- <Badge variant="ghost" /> // No background
58
- <Badge variant="info" /> // Blue/info style
59
- <Badge variant="warning" /> // Amber/warning style
60
- <Badge variant="success" /> // Green/success style
61
- <Badge variant="destructive" /> // Red/error style
62
- ```
63
-
64
- ### Sizes
65
-
66
- Use the `size` prop to change the badge size.
67
-
68
- <Flavored radix={<BadgeRadixSamples.BadgeSizesSample />} base={<BadgeSizesSample />} />
69
-
70
- ```tsx
71
- <Badge size="sm" /> // Small
72
- <Badge size="default" /> // Default
73
- <Badge size="lg" /> // Large
74
- ```
75
-
76
- ### With Icons
77
-
78
- Badges automatically style SVG icons.
79
-
80
- <PreviewCode file="components/docs/samples/badge" name="BadgeWithIconSample" base={<BadgeWithIconSample />}>
81
- <BadgeRadixSamples.BadgeWithIconSample />
82
- </PreviewCode>
83
-
84
- ### As Link
85
-
86
- Compose with `render` (Base UI) or `asChild` (Radix) to render the badge as a different element, like a link.
87
-
88
- <PreviewCode file="components/docs/samples/badge" name="BadgeAsLinkSample" base={<BadgeAsLinkSample />}>
89
- <BadgeRadixSamples.BadgeAsLinkSample />
90
- </PreviewCode>
91
-
92
- ### Animated
93
-
94
- Combine with CSS transitions for scroll and color animations.
95
-
96
- <PreviewCode file="components/docs/samples/badge" name="BadgeAnimatedSample" base={<BadgeAnimatedSample />}>
97
- <BadgeRadixSamples.BadgeAnimatedSample />
98
- </PreviewCode>
99
-
100
- ## API Reference
101
-
102
- ### Badge
103
-
104
- <ParametersTable
105
- type="BadgeProps"
106
- parameters={[
107
- {
108
- name: "variant",
109
- type: '"outline" | "secondary" | "muted" | "ghost" | "info" | "warning" | "success" | "destructive"',
110
- default: '"outline"',
111
- description: "The visual style of the badge.",
112
- },
113
- {
114
- name: "size",
115
- type: '"sm" | "default" | "lg"',
116
- default: '"default"',
117
- description: "The size of the badge.",
118
- },
119
- {
120
- name: "render",
121
- type: "ReactElement | function",
122
- description: "Base UI: compose as a different element instead of rendering a span.",
123
- },
124
- {
125
- name: "asChild",
126
- type: "boolean",
127
- default: "false",
128
- description: "Radix: merge props with a child element instead of rendering a span.",
129
- },
130
- {
131
- name: "className",
132
- type: "string",
133
- description: "Additional CSS classes.",
134
- },
135
- ]}
136
- />
137
-
138
- ### Style Variants (CVA)
139
-
140
- | Export | Description |
141
- |--------|-------------|
142
- | `badgeVariants` | Styles for the badge component. |
143
-
144
- ```tsx
145
- import { badgeVariants } from "@/components/assistant-ui/badge";
146
-
147
- <span className={badgeVariants({ variant: "muted", size: "sm" })}>
148
- Custom Badge
149
- </span>
150
- ```
@@ -1,280 +0,0 @@
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
- platforms: ["react"]
10
- ---
11
-
12
- import { PreviewCode } from "@/components/docs/preview-code.server";
13
- import {
14
- DiffViewerSample,
15
- DiffViewerSplitSample,
16
- DiffViewerViewModesSample,
17
- DiffViewerVariantsSample,
18
- DiffViewerSizesSample,
19
- } from "@/components/docs/samples/diff-viewer";
20
-
21
- <Callout>
22
- This is a **standalone component** that does not depend on the assistant-ui runtime.
23
- </Callout>
24
-
25
- <DiffViewerViewModesSample />
26
-
27
- ## Installation
28
-
29
- <InstallCommand shadcn={["diff-viewer"]} />
30
-
31
- ## Usage
32
-
33
- ```tsx
34
- import { DiffViewer } from "@/components/assistant-ui/diff-viewer";
35
-
36
- // With a unified diff patch
37
- <DiffViewer patch={diffString} />
38
-
39
- // With file comparison
40
- <DiffViewer
41
- oldFile={{ content: "old content", name: "file.txt" }}
42
- newFile={{ content: "new content", name: "file.txt" }}
43
- />
44
- ```
45
-
46
- ### As Markdown Language Override
47
-
48
- Integrate with `MarkdownTextPrimitive` to render diff code blocks:
49
-
50
- ```tsx title="/components/assistant-ui/markdown-text.tsx"
51
- import { DiffViewer } from "@/components/assistant-ui/diff-viewer"; // [!code ++]
52
-
53
- const MarkdownTextImpl = () => {
54
- return (
55
- <MarkdownTextPrimitive
56
- remarkPlugins={[remarkGfm]}
57
- className="aui-md"
58
- components={defaultComponents}
59
- componentsByLanguage={{ // [!code ++]
60
- diff: { // [!code ++]
61
- SyntaxHighlighter: ({ code }) => <DiffViewer patch={code} /> // [!code ++]
62
- }, // [!code ++]
63
- }} // [!code ++]
64
- />
65
- );
66
- };
67
-
68
- export const MarkdownText = memo(MarkdownTextImpl);
69
- ```
70
-
71
- ## Examples
72
-
73
- ### Unified View
74
-
75
- Shows all changes in a single column with `+`/`-` indicators. This is the default mode.
76
-
77
- <DiffViewerSample />
78
-
79
- ```tsx
80
- <DiffViewer patch={diffString} viewMode="unified" />
81
- ```
82
-
83
- ### Split View
84
-
85
- Shows old content on the left, new content on the right side-by-side.
86
-
87
- <DiffViewerSplitSample />
88
-
89
- ```tsx
90
- <DiffViewer patch={diffString} viewMode="split" />
91
- ```
92
-
93
- ### Interactive Mode Toggle
94
-
95
- <PreviewCode file="components/docs/samples/diff-viewer" name="DiffViewerViewModesSample">
96
- <DiffViewerViewModesSample />
97
- </PreviewCode>
98
-
99
- ### Variants
100
-
101
- <DiffViewerVariantsSample />
102
-
103
- ### Sizes
104
-
105
- <DiffViewerSizesSample />
106
-
107
- ### Theming
108
-
109
- DiffViewer uses CSS variables for colors. Override them in your CSS:
110
-
111
- ```css
112
- [data-slot="diff-viewer"] {
113
- --diff-add-bg: rgba(46, 160, 67, 0.15);
114
- --diff-add-text: #1a7f37;
115
- --diff-add-text-dark: #3fb950;
116
- --diff-del-bg: rgba(248, 81, 73, 0.15);
117
- --diff-del-text: #cf222e;
118
- --diff-del-text-dark: #f85149;
119
- }
120
- ```
121
-
122
- | Variable | Description |
123
- |----------|-------------|
124
- | `--diff-add-bg` | Background for added lines |
125
- | `--diff-add-text` | Text color for added lines (light mode) |
126
- | `--diff-add-text-dark` | Text color for added lines (dark mode) |
127
- | `--diff-del-bg` | Background for deleted lines |
128
- | `--diff-del-text` | Text color for deleted lines (light mode) |
129
- | `--diff-del-text-dark` | Text color for deleted lines (dark mode) |
130
-
131
- ## API Reference
132
-
133
- ### DiffViewer
134
-
135
- The main component for rendering diffs.
136
-
137
- <ParametersTable
138
- type="DiffViewerProps"
139
- parameters={[
140
- {
141
- name: "patch",
142
- type: "string",
143
- description: "Unified diff string (e.g., output from git diff).",
144
- },
145
- {
146
- name: "code",
147
- type: "string",
148
- description: "Alias for patch (for markdown integration).",
149
- },
150
- {
151
- name: "oldFile",
152
- type: "{ content: string; name?: string }",
153
- description: "Old file for direct comparison.",
154
- },
155
- {
156
- name: "newFile",
157
- type: "{ content: string; name?: string }",
158
- description: "New file for direct comparison.",
159
- },
160
- {
161
- name: "viewMode",
162
- type: '"unified" | "split"',
163
- default: '"unified"',
164
- description: "Display mode for the diff.",
165
- },
166
- {
167
- name: "variant",
168
- type: '"default" | "ghost" | "muted"',
169
- default: '"default"',
170
- description: "Visual style variant.",
171
- },
172
- {
173
- name: "size",
174
- type: '"sm" | "default" | "lg"',
175
- default: '"default"',
176
- description: "Font size.",
177
- },
178
- {
179
- name: "showLineNumbers",
180
- type: "boolean",
181
- default: "true",
182
- description: "Show line numbers.",
183
- },
184
- {
185
- name: "showIcon",
186
- type: "boolean",
187
- default: "true",
188
- description: "Show file extension badge in header.",
189
- },
190
- {
191
- name: "showStats",
192
- type: "boolean",
193
- default: "true",
194
- description: "Show addition/deletion counts in header.",
195
- },
196
- {
197
- name: "className",
198
- type: "string",
199
- description: "Additional CSS classes.",
200
- },
201
- ]}
202
- />
203
-
204
- ### Composable API
205
-
206
- | Component | Description |
207
- |-----------|-------------|
208
- | `DiffViewer` | Main component that renders the diff. |
209
- | `DiffViewerFile` | Wrapper for each file in multi-file diffs. |
210
- | `DiffViewerHeader` | File name header with icon and stats. |
211
- | `DiffViewerContent` | Scrollable content area. |
212
- | `DiffViewerLine` | Individual line in unified mode. |
213
- | `DiffViewerSplitLine` | Side-by-side line pair in split mode. |
214
- | `DiffViewerFileBadge` | File extension badge (e.g., "TS"). |
215
- | `DiffViewerStats` | Addition/deletion count display. |
216
-
217
- ### Style Variants (CVA)
218
-
219
- | Export | Description |
220
- |--------|-------------|
221
- | `diffViewerVariants` | Styles for the root container. |
222
- | `diffLineVariants` | Background styles for diff lines. |
223
- | `diffLineTextVariants` | Text color styles for diff lines. |
224
-
225
- ```tsx
226
- import {
227
- diffViewerVariants,
228
- diffLineVariants,
229
- diffLineTextVariants,
230
- } from "@/components/assistant-ui/diff-viewer";
231
-
232
- // Use variants directly
233
- <div className={diffViewerVariants({ variant: "ghost", size: "sm" })}>
234
- Custom diff container
235
- </div>
236
- ```
237
-
238
- ### Utilities
239
-
240
- | Export | Description |
241
- |--------|-------------|
242
- | `parsePatch(patch)` | Parse unified diff string into structured data. |
243
- | `computeDiff(old, new)` | Compute diff between two strings. |
244
- | `ParsedLine` | Type for a single diff line. |
245
- | `ParsedFile` | Type for a parsed file with lines and stats. |
246
- | `SplitLinePair` | Type for a side-by-side line pair. |
247
-
248
- ## Styling
249
-
250
- ### Data Attributes
251
-
252
- Use data attributes for custom styling:
253
-
254
- | Attribute | Values | Description |
255
- |-----------|--------|-------------|
256
- | `data-slot` | `"diff-viewer"`, `"diff-viewer-header"`, `"diff-viewer-line"`, etc. | Component identification |
257
- | `data-type` | `"add"`, `"del"`, `"normal"`, `"empty"` | Line type |
258
- | `data-view-mode` | `"unified"`, `"split"` | Current view mode |
259
- | `data-variant` | `"default"`, `"ghost"`, `"muted"` | Current variant |
260
-
261
- ### Custom CSS Example
262
-
263
- ```css
264
- [data-slot="diff-viewer"][data-view-mode="split"] {
265
- /* Custom split view styles */
266
- }
267
-
268
- [data-slot="diff-viewer-line"][data-type="add"] {
269
- /* Custom addition styles */
270
- }
271
-
272
- [data-slot="diff-viewer-line"][data-type="del"] {
273
- /* Custom deletion styles */
274
- }
275
- ```
276
-
277
- ## Related Components
278
-
279
- - [Markdown](/docs/ui/markdown) - Rich text rendering where diff viewer can be integrated
280
- - [Syntax Highlighting](/docs/ui/syntax-highlighting) - Code highlighting for other languages