@assistant-ui/mcp-docs-server 0.2.2 → 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 (167) hide show
  1. package/.docs/organized/code-examples/waterfall.md +2 -2
  2. package/.docs/organized/code-examples/with-a2a.md +4 -3
  3. package/.docs/organized/code-examples/with-ag-ui.md +5 -4
  4. package/.docs/organized/code-examples/with-ai-sdk-v7.md +12 -11
  5. package/.docs/organized/code-examples/with-artifacts.md +10 -9
  6. package/.docs/organized/code-examples/with-assistant-transport.md +4 -3
  7. package/.docs/organized/code-examples/with-browser-extension.md +3 -3
  8. package/.docs/organized/code-examples/with-chain-of-thought.md +14 -12
  9. package/.docs/organized/code-examples/with-cloud-standalone.md +5 -5
  10. package/.docs/organized/code-examples/with-cloud.md +9 -8
  11. package/.docs/organized/code-examples/with-custom-thread-list.md +8 -7
  12. package/.docs/organized/code-examples/with-elevenlabs-conversational.md +12 -11
  13. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +12 -11
  14. package/.docs/organized/code-examples/with-eve.md +5 -4
  15. package/.docs/organized/code-examples/with-expo.md +214 -31
  16. package/.docs/organized/code-examples/with-external-store.md +4 -3
  17. package/.docs/organized/code-examples/with-ffmpeg.md +9 -8
  18. package/.docs/organized/code-examples/with-generative-ui.md +13 -15
  19. package/.docs/organized/code-examples/with-google-adk.md +4 -3
  20. package/.docs/organized/code-examples/with-heat-graph.md +2 -2
  21. package/.docs/organized/code-examples/with-image-generation.md +7 -6
  22. package/.docs/organized/code-examples/with-interactables.md +9 -8
  23. package/.docs/organized/code-examples/with-langchain.md +6 -5
  24. package/.docs/organized/code-examples/with-langgraph.md +6 -5
  25. package/.docs/organized/code-examples/with-livekit.md +13 -12
  26. package/.docs/organized/code-examples/with-mcp.md +11 -9
  27. package/.docs/organized/code-examples/with-nuxt.md +502 -502
  28. package/.docs/organized/code-examples/with-opencode.md +3 -3
  29. package/.docs/organized/code-examples/with-openui.md +14 -13
  30. package/.docs/organized/code-examples/with-pi.md +5 -4
  31. package/.docs/organized/code-examples/with-react-hook-form.md +13 -10
  32. package/.docs/organized/code-examples/with-react-ink-web.md +64 -14
  33. package/.docs/organized/code-examples/with-react-ink.md +3 -2
  34. package/.docs/organized/code-examples/with-react-router.md +6 -5
  35. package/.docs/organized/code-examples/with-resumable-stream.md +10 -9
  36. package/.docs/organized/code-examples/with-store.md +2 -2
  37. package/.docs/organized/code-examples/with-svelte.md +3 -3
  38. package/.docs/organized/code-examples/with-sveltekit.md +9 -9
  39. package/.docs/organized/code-examples/with-tanstack.md +8 -7
  40. package/.docs/organized/code-examples/with-tap-runtime.md +4 -3
  41. package/.docs/organized/code-examples/with-virtualized-thread.md +5 -4
  42. package/.docs/organized/code-examples/with-vue.md +2 -2
  43. package/.docs/raw/docs/{(docs) → (getting-started)}/devtools.mdx +1 -1
  44. package/.docs/raw/docs/{(docs) → (getting-started)}/index.mdx +4 -2
  45. package/.docs/raw/docs/{(docs) → (getting-started)}/installation.mdx +24 -24
  46. package/.docs/raw/docs/(reference)/api-reference/adapters/suggestions.mdx +6 -0
  47. package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +1 -1
  48. package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +6 -1
  49. package/.docs/raw/docs/(reference)/api-reference/integrations/{react-ai-sdk.mdx → ai-sdk.mdx} +19 -19
  50. package/.docs/raw/docs/(reference)/api-reference/integrations/eve.mdx +22 -1
  51. package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +3 -3
  52. package/.docs/raw/docs/(reference)/api-reference/overview.mdx +2 -2
  53. package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +20 -2
  54. package/.docs/raw/docs/(reference)/api-reference/tools/interactables.mdx +1 -1
  55. package/.docs/raw/docs/(reference)/api-reference/transport/frame.mdx +1 -1
  56. package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +3 -0
  57. package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +10 -10
  58. package/.docs/raw/docs/cloud/ai-sdk.mdx +2 -0
  59. package/.docs/raw/docs/copilots/assistant-frame.mdx +19 -8
  60. package/.docs/raw/docs/guides/attachments.mdx +2 -2
  61. package/.docs/raw/docs/guides/branching.mdx +1 -1
  62. package/.docs/raw/docs/guides/chatgpt-subscription.mdx +1 -1
  63. package/.docs/raw/docs/guides/dictation.mdx +1 -1
  64. package/.docs/raw/docs/guides/electron.mdx +1 -1
  65. package/.docs/raw/docs/guides/latex.mdx +1 -1
  66. package/.docs/raw/docs/guides/message-timing.mdx +11 -5
  67. package/.docs/raw/docs/guides/quoting.mdx +1 -1
  68. package/.docs/raw/docs/guides/resumable-streams.mdx +3 -3
  69. package/.docs/raw/docs/guides/speech.mdx +1 -1
  70. package/.docs/raw/docs/guides/suggestions.mdx +2 -2
  71. package/.docs/raw/docs/guides/voice.mdx +1 -1
  72. package/.docs/raw/docs/ink/hooks.mdx +1 -1
  73. package/.docs/raw/docs/ink/index.mdx +3 -2
  74. package/.docs/raw/docs/ink/migration.mdx +1 -1
  75. package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +3 -3
  76. package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +3 -3
  77. package/.docs/raw/docs/integrations/frameworks/{cloudflare-agents/overview.mdx → cloudflare-agents.mdx} +4 -3
  78. package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +1 -1
  79. package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +1 -1
  80. package/.docs/raw/docs/integrations/index.mdx +2 -2
  81. package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +3 -3
  82. package/.docs/raw/docs/migrations/toolkit-tools.mdx +2 -2
  83. package/.docs/raw/docs/primitives/action-bar.mdx +1 -1
  84. package/.docs/raw/docs/primitives/assistant-modal.mdx +1 -1
  85. package/.docs/raw/docs/primitives/attachment.mdx +1 -1
  86. package/.docs/raw/docs/primitives/branch-picker.mdx +1 -1
  87. package/.docs/raw/docs/primitives/chain-of-thought.mdx +3 -3
  88. package/.docs/raw/docs/primitives/composer.mdx +1 -1
  89. package/.docs/raw/docs/primitives/error.mdx +1 -1
  90. package/.docs/raw/docs/primitives/message.mdx +1 -1
  91. package/.docs/raw/docs/primitives/selection-toolbar.mdx +1 -1
  92. package/.docs/raw/docs/primitives/suggestion.mdx +1 -1
  93. package/.docs/raw/docs/primitives/thread-list.mdx +1 -1
  94. package/.docs/raw/docs/primitives/thread.mdx +1 -1
  95. package/.docs/raw/docs/react-native/adapters.mdx +1 -1
  96. package/.docs/raw/docs/react-native/index.mdx +2 -2
  97. package/.docs/raw/docs/react-native/migration.mdx +2 -2
  98. package/.docs/raw/docs/react-native/primitives.mdx +142 -5
  99. package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +13 -1
  100. package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +3 -3
  101. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +4 -4
  102. package/.docs/raw/docs/runtimes/ai-sdk/v7.mdx +31 -16
  103. package/.docs/raw/docs/runtimes/concepts/adapters.mdx +3 -3
  104. package/.docs/raw/docs/runtimes/concepts/architecture.mdx +3 -3
  105. package/.docs/raw/docs/runtimes/concepts/threads.mdx +5 -5
  106. package/.docs/raw/docs/runtimes/langchain.mdx +1 -1
  107. package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +1 -1
  108. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +1 -1
  109. package/.docs/raw/docs/tools/backend.mdx +4 -4
  110. package/.docs/raw/docs/tools/defining-tools.mdx +2 -2
  111. package/.docs/raw/docs/tools/generative-ui.mdx +2 -2
  112. package/.docs/raw/docs/tools/interactables.mdx +3 -3
  113. package/.docs/raw/docs/tools/mcp-apps.mdx +18 -1
  114. package/.docs/raw/docs/tools/mcp.mdx +2 -2
  115. package/.docs/raw/docs/tools/openui.mdx +2 -2
  116. package/.docs/raw/docs/tools/tool-ui.mdx +17 -5
  117. package/.docs/raw/docs/tools/user-managed-mcp.mdx +2 -2
  118. package/.docs/raw/docs/ui/assistant-modal.mdx +3 -3
  119. package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -1
  120. package/.docs/raw/docs/ui/attachment.mdx +30 -10
  121. package/.docs/raw/docs/ui/composer-trigger-popover.mdx +36 -1
  122. package/.docs/raw/docs/ui/context-display.mdx +1 -1
  123. package/.docs/raw/docs/ui/directive-text.mdx +1 -1
  124. package/.docs/raw/docs/ui/file.mdx +1 -1
  125. package/.docs/raw/docs/ui/follow-up-suggestions.mdx +1 -1
  126. package/.docs/raw/docs/ui/image.mdx +1 -1
  127. package/.docs/raw/docs/ui/markdown.mdx +40 -1
  128. package/.docs/raw/docs/ui/mermaid.mdx +1 -1
  129. package/.docs/raw/docs/ui/message-timing.mdx +1 -1
  130. package/.docs/raw/docs/ui/model-selector.mdx +4 -4
  131. package/.docs/raw/docs/ui/part-grouping.mdx +1 -1
  132. package/.docs/raw/docs/ui/quote.mdx +3 -3
  133. package/.docs/raw/docs/ui/reasoning.mdx +31 -3
  134. package/.docs/raw/docs/ui/scrollbar.mdx +1 -1
  135. package/.docs/raw/docs/ui/sources.mdx +10 -1
  136. package/.docs/raw/docs/ui/streamdown.mdx +2 -2
  137. package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -1
  138. package/.docs/raw/docs/ui/thread-list.mdx +40 -1
  139. package/.docs/raw/docs/ui/thread.mdx +49 -2
  140. package/.docs/raw/docs/ui/tool-fallback.mdx +23 -9
  141. package/.docs/raw/docs/ui/tool-group.mdx +1 -1
  142. package/.docs/raw/docs/ui/voice.mdx +1 -1
  143. package/.docs/raw/docs/utilities/react-o11y.mdx +2 -2
  144. package/dist/xulux/catalog-client.d.ts.map +1 -1
  145. package/dist/xulux/catalog-client.js +51 -6
  146. package/dist/xulux/catalog-client.js.map +1 -1
  147. package/dist/xulux/types.d.ts +7 -7
  148. package/dist/xulux/types.d.ts.map +1 -1
  149. package/dist/xulux/types.js.map +1 -1
  150. package/package.json +3 -3
  151. package/src/tools/tests/docs.test.ts +10 -7
  152. package/src/tools/tests/path-traversal.test.ts +5 -2
  153. package/src/tools/tests/xulux-templates.test.ts +63 -0
  154. package/src/xulux/catalog-client.ts +68 -23
  155. package/src/xulux/types.ts +17 -13
  156. package/.docs/raw/docs/ui/accordion.mdx +0 -266
  157. package/.docs/raw/docs/ui/badge.mdx +0 -150
  158. package/.docs/raw/docs/ui/diff-viewer.mdx +0 -280
  159. package/.docs/raw/docs/ui/dot-matrix.mdx +0 -133
  160. package/.docs/raw/docs/ui/number-roll.mdx +0 -154
  161. package/.docs/raw/docs/ui/select.mdx +0 -254
  162. package/.docs/raw/docs/ui/tabs.mdx +0 -271
  163. /package/.docs/raw/docs/{(docs) → (getting-started)}/architecture.mdx +0 -0
  164. /package/.docs/raw/docs/{(docs) → (getting-started)}/base-ui.mdx +0 -0
  165. /package/.docs/raw/docs/{(docs) → (getting-started)}/cli.mdx +0 -0
  166. /package/.docs/raw/docs/{(docs) → (getting-started)}/llm.mdx +0 -0
  167. /package/.docs/raw/docs/{(docs) → (getting-started)}/rtl.mdx +0 -0
@@ -1,11 +1,65 @@
1
+ import { z } from "zod";
1
2
  import { logger } from "../utils/logger.js";
2
3
  import { FALLBACK_CATALOG, FALLBACK_NOTE } from "./fallback-catalog.js";
3
- import type { XuluxCatalog, XuluxCatalogResult } from "./types.js";
4
+ import {
5
+ XULUX_MCP_CATALOG_VERSION,
6
+ type XuluxCatalog,
7
+ type XuluxCatalogResult,
8
+ } from "./types.js";
4
9
 
5
10
  export const DEFAULT_CATALOG_URL =
6
11
  "https://www.assistant-ui.com/api/xulux/mcp-catalog";
7
12
 
8
13
  const CATALOG_TTL_MS = 5 * 60 * 1000;
14
+ const catalogUrlSchema = z.url();
15
+
16
+ const catalogVersionSchema = z.looseObject({
17
+ id: z.string(),
18
+ entryId: z.string(),
19
+ name: z.string(),
20
+ description: z.string(),
21
+ previewUrl: catalogUrlSchema,
22
+ downloadUrl: catalogUrlSchema,
23
+ });
24
+
25
+ const catalogTemplateSchema = z.looseObject({
26
+ id: z.string(),
27
+ templateId: z.string(),
28
+ versionId: z.string().nullable(),
29
+ kind: z.enum(["template", "example"]),
30
+ name: z.string(),
31
+ summary: z.string(),
32
+ assistantPlacement: z.string(),
33
+ features: z.array(z.string()),
34
+ customizable: z.array(z.string()),
35
+ versions: z.array(catalogVersionSchema),
36
+ previewUrl: catalogUrlSchema.optional(),
37
+ downloadUrl: catalogUrlSchema.optional(),
38
+ sandboxBaseUrl: catalogUrlSchema.optional(),
39
+ configRoots: z.record(z.string(), z.unknown()).optional(),
40
+ rules: z
41
+ .looseObject({
42
+ required: z.array(z.string()),
43
+ unsupported: z.array(z.string()).optional(),
44
+ })
45
+ .optional(),
46
+ tools: z
47
+ .looseObject({
48
+ builtIn: z.array(z.unknown()),
49
+ customToolSupported: z.boolean(),
50
+ renderers: z.array(z.unknown()),
51
+ })
52
+ .optional(),
53
+ });
54
+
55
+ const catalogSchema = z.looseObject({
56
+ version: z.literal(XULUX_MCP_CATALOG_VERSION),
57
+ // Not read anywhere in the package; validated for shape only, so an unused
58
+ // field cannot veto the whole catalog.
59
+ generatedAt: z.string(),
60
+ docsOrigin: z.string(),
61
+ templates: z.array(catalogTemplateSchema),
62
+ });
9
63
 
10
64
  export function getCatalogUrl(): string {
11
65
  const override = process.env.XULUX_CATALOG_URL?.trim();
@@ -13,32 +67,23 @@ export function getCatalogUrl(): string {
13
67
  }
14
68
 
15
69
  function validateCatalog(data: unknown): XuluxCatalog {
16
- if (!data || typeof data !== "object" || Array.isArray(data)) {
17
- throw new Error("Catalog response is not a JSON object.");
18
- }
19
- const catalog = data as XuluxCatalog;
20
- if (catalog.version !== 1) {
70
+ // Checked ahead of the schema so a catalog rollout reports its version
71
+ // rather than reading as a malformed payload.
72
+ const version = (data as { version?: unknown } | null)?.version;
73
+ if (version !== undefined && version !== XULUX_MCP_CATALOG_VERSION) {
21
74
  throw new Error(
22
- `Unsupported catalog version: ${String(catalog.version)}. Expected 1.`,
75
+ `Unsupported catalog version: ${String(version)}. Expected ${XULUX_MCP_CATALOG_VERSION}.`,
23
76
  );
24
77
  }
25
- if (!Array.isArray(catalog.templates)) {
26
- throw new Error("Catalog response has no templates array.");
27
- }
28
- for (const template of catalog.templates) {
29
- if (
30
- !template ||
31
- typeof template !== "object" ||
32
- typeof template.id !== "string" ||
33
- typeof template.templateId !== "string" ||
34
- (template.kind !== "template" && template.kind !== "example")
35
- ) {
36
- throw new Error(
37
- "Catalog response contains a malformed template entry (missing id/templateId/kind).",
38
- );
39
- }
78
+ const result = catalogSchema.safeParse(data);
79
+ if (!result.success) {
80
+ const issue = result.error.issues[0];
81
+ const path = issue?.path.length ? ` at ${issue.path.join(".")}` : "";
82
+ throw new Error(
83
+ `Catalog response is malformed${path}: ${issue?.message ?? "invalid catalog"}.`,
84
+ );
40
85
  }
41
- return catalog;
86
+ return result.data;
42
87
  }
43
88
 
44
89
  interface CacheEntry {
@@ -24,19 +24,23 @@ export interface XuluxCatalogTemplate {
24
24
  features: string[];
25
25
  customizable: string[];
26
26
  versions: XuluxCatalogVersion[];
27
- previewUrl?: string;
28
- downloadUrl?: string;
29
- sandboxBaseUrl?: string;
30
- configRoots?: Record<string, unknown>;
31
- rules?: {
32
- required: string[];
33
- unsupported?: string[];
34
- };
35
- tools?: {
36
- builtIn: unknown[];
37
- customToolSupported: boolean;
38
- renderers: unknown[];
39
- };
27
+ previewUrl?: string | undefined;
28
+ downloadUrl?: string | undefined;
29
+ sandboxBaseUrl?: string | undefined;
30
+ configRoots?: Record<string, unknown> | undefined;
31
+ rules?:
32
+ | {
33
+ required: string[];
34
+ unsupported?: string[] | undefined;
35
+ }
36
+ | undefined;
37
+ tools?:
38
+ | {
39
+ builtIn: unknown[];
40
+ customToolSupported: boolean;
41
+ renderers: unknown[];
42
+ }
43
+ | undefined;
40
44
  }
41
45
 
42
46
  export interface XuluxCatalog {
@@ -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
- ```