@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.
- package/.docs/organized/code-examples/waterfall.md +2 -2
- package/.docs/organized/code-examples/with-a2a.md +4 -3
- package/.docs/organized/code-examples/with-ag-ui.md +5 -4
- package/.docs/organized/code-examples/with-ai-sdk-v7.md +12 -11
- package/.docs/organized/code-examples/with-artifacts.md +10 -9
- package/.docs/organized/code-examples/with-assistant-transport.md +4 -3
- package/.docs/organized/code-examples/with-browser-extension.md +3 -3
- package/.docs/organized/code-examples/with-chain-of-thought.md +14 -12
- package/.docs/organized/code-examples/with-cloud-standalone.md +5 -5
- package/.docs/organized/code-examples/with-cloud.md +9 -8
- package/.docs/organized/code-examples/with-custom-thread-list.md +8 -7
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +12 -11
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +12 -11
- package/.docs/organized/code-examples/with-eve.md +5 -4
- package/.docs/organized/code-examples/with-expo.md +214 -31
- package/.docs/organized/code-examples/with-external-store.md +4 -3
- package/.docs/organized/code-examples/with-ffmpeg.md +9 -8
- package/.docs/organized/code-examples/with-generative-ui.md +13 -15
- package/.docs/organized/code-examples/with-google-adk.md +4 -3
- package/.docs/organized/code-examples/with-heat-graph.md +2 -2
- package/.docs/organized/code-examples/with-image-generation.md +7 -6
- package/.docs/organized/code-examples/with-interactables.md +9 -8
- package/.docs/organized/code-examples/with-langchain.md +6 -5
- package/.docs/organized/code-examples/with-langgraph.md +6 -5
- package/.docs/organized/code-examples/with-livekit.md +13 -12
- package/.docs/organized/code-examples/with-mcp.md +11 -9
- package/.docs/organized/code-examples/with-nuxt.md +502 -502
- package/.docs/organized/code-examples/with-opencode.md +3 -3
- package/.docs/organized/code-examples/with-openui.md +14 -13
- package/.docs/organized/code-examples/with-pi.md +5 -4
- package/.docs/organized/code-examples/with-react-hook-form.md +13 -10
- package/.docs/organized/code-examples/with-react-ink-web.md +64 -14
- package/.docs/organized/code-examples/with-react-ink.md +3 -2
- package/.docs/organized/code-examples/with-react-router.md +6 -5
- package/.docs/organized/code-examples/with-resumable-stream.md +10 -9
- package/.docs/organized/code-examples/with-store.md +2 -2
- package/.docs/organized/code-examples/with-svelte.md +3 -3
- package/.docs/organized/code-examples/with-sveltekit.md +9 -9
- package/.docs/organized/code-examples/with-tanstack.md +8 -7
- package/.docs/organized/code-examples/with-tap-runtime.md +4 -3
- package/.docs/organized/code-examples/with-virtualized-thread.md +5 -4
- package/.docs/organized/code-examples/with-vue.md +2 -2
- package/.docs/raw/docs/{(docs) → (getting-started)}/devtools.mdx +1 -1
- package/.docs/raw/docs/{(docs) → (getting-started)}/index.mdx +4 -2
- package/.docs/raw/docs/{(docs) → (getting-started)}/installation.mdx +24 -24
- package/.docs/raw/docs/(reference)/api-reference/adapters/suggestions.mdx +6 -0
- package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +6 -1
- package/.docs/raw/docs/(reference)/api-reference/integrations/{react-ai-sdk.mdx → ai-sdk.mdx} +19 -19
- package/.docs/raw/docs/(reference)/api-reference/integrations/eve.mdx +22 -1
- package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +3 -3
- package/.docs/raw/docs/(reference)/api-reference/overview.mdx +2 -2
- package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +20 -2
- package/.docs/raw/docs/(reference)/api-reference/tools/interactables.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/transport/frame.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +3 -0
- package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +10 -10
- package/.docs/raw/docs/cloud/ai-sdk.mdx +2 -0
- package/.docs/raw/docs/copilots/assistant-frame.mdx +19 -8
- package/.docs/raw/docs/guides/attachments.mdx +2 -2
- package/.docs/raw/docs/guides/branching.mdx +1 -1
- package/.docs/raw/docs/guides/chatgpt-subscription.mdx +1 -1
- package/.docs/raw/docs/guides/dictation.mdx +1 -1
- package/.docs/raw/docs/guides/electron.mdx +1 -1
- package/.docs/raw/docs/guides/latex.mdx +1 -1
- package/.docs/raw/docs/guides/message-timing.mdx +11 -5
- package/.docs/raw/docs/guides/quoting.mdx +1 -1
- package/.docs/raw/docs/guides/resumable-streams.mdx +3 -3
- package/.docs/raw/docs/guides/speech.mdx +1 -1
- package/.docs/raw/docs/guides/suggestions.mdx +2 -2
- package/.docs/raw/docs/guides/voice.mdx +1 -1
- package/.docs/raw/docs/ink/hooks.mdx +1 -1
- package/.docs/raw/docs/ink/index.mdx +3 -2
- package/.docs/raw/docs/ink/migration.mdx +1 -1
- package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +3 -3
- package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +3 -3
- package/.docs/raw/docs/integrations/frameworks/{cloudflare-agents/overview.mdx → cloudflare-agents.mdx} +4 -3
- package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +1 -1
- package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +1 -1
- package/.docs/raw/docs/integrations/index.mdx +2 -2
- package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +3 -3
- package/.docs/raw/docs/migrations/toolkit-tools.mdx +2 -2
- package/.docs/raw/docs/primitives/action-bar.mdx +1 -1
- package/.docs/raw/docs/primitives/assistant-modal.mdx +1 -1
- package/.docs/raw/docs/primitives/attachment.mdx +1 -1
- package/.docs/raw/docs/primitives/branch-picker.mdx +1 -1
- package/.docs/raw/docs/primitives/chain-of-thought.mdx +3 -3
- package/.docs/raw/docs/primitives/composer.mdx +1 -1
- package/.docs/raw/docs/primitives/error.mdx +1 -1
- package/.docs/raw/docs/primitives/message.mdx +1 -1
- package/.docs/raw/docs/primitives/selection-toolbar.mdx +1 -1
- package/.docs/raw/docs/primitives/suggestion.mdx +1 -1
- package/.docs/raw/docs/primitives/thread-list.mdx +1 -1
- package/.docs/raw/docs/primitives/thread.mdx +1 -1
- package/.docs/raw/docs/react-native/adapters.mdx +1 -1
- package/.docs/raw/docs/react-native/index.mdx +2 -2
- package/.docs/raw/docs/react-native/migration.mdx +2 -2
- package/.docs/raw/docs/react-native/primitives.mdx +142 -5
- package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +13 -1
- package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +3 -3
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +4 -4
- package/.docs/raw/docs/runtimes/ai-sdk/v7.mdx +31 -16
- package/.docs/raw/docs/runtimes/concepts/adapters.mdx +3 -3
- package/.docs/raw/docs/runtimes/concepts/architecture.mdx +3 -3
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +5 -5
- package/.docs/raw/docs/runtimes/langchain.mdx +1 -1
- package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +1 -1
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +1 -1
- package/.docs/raw/docs/tools/backend.mdx +4 -4
- package/.docs/raw/docs/tools/defining-tools.mdx +2 -2
- package/.docs/raw/docs/tools/generative-ui.mdx +2 -2
- package/.docs/raw/docs/tools/interactables.mdx +3 -3
- package/.docs/raw/docs/tools/mcp-apps.mdx +18 -1
- package/.docs/raw/docs/tools/mcp.mdx +2 -2
- package/.docs/raw/docs/tools/openui.mdx +2 -2
- package/.docs/raw/docs/tools/tool-ui.mdx +17 -5
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +2 -2
- package/.docs/raw/docs/ui/assistant-modal.mdx +3 -3
- package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -1
- package/.docs/raw/docs/ui/attachment.mdx +30 -10
- package/.docs/raw/docs/ui/composer-trigger-popover.mdx +36 -1
- package/.docs/raw/docs/ui/context-display.mdx +1 -1
- package/.docs/raw/docs/ui/directive-text.mdx +1 -1
- package/.docs/raw/docs/ui/file.mdx +1 -1
- package/.docs/raw/docs/ui/follow-up-suggestions.mdx +1 -1
- package/.docs/raw/docs/ui/image.mdx +1 -1
- package/.docs/raw/docs/ui/markdown.mdx +40 -1
- package/.docs/raw/docs/ui/mermaid.mdx +1 -1
- package/.docs/raw/docs/ui/message-timing.mdx +1 -1
- package/.docs/raw/docs/ui/model-selector.mdx +4 -4
- package/.docs/raw/docs/ui/part-grouping.mdx +1 -1
- package/.docs/raw/docs/ui/quote.mdx +3 -3
- package/.docs/raw/docs/ui/reasoning.mdx +31 -3
- package/.docs/raw/docs/ui/scrollbar.mdx +1 -1
- package/.docs/raw/docs/ui/sources.mdx +10 -1
- package/.docs/raw/docs/ui/streamdown.mdx +2 -2
- package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -1
- package/.docs/raw/docs/ui/thread-list.mdx +40 -1
- package/.docs/raw/docs/ui/thread.mdx +49 -2
- package/.docs/raw/docs/ui/tool-fallback.mdx +23 -9
- package/.docs/raw/docs/ui/tool-group.mdx +1 -1
- package/.docs/raw/docs/ui/voice.mdx +1 -1
- package/.docs/raw/docs/utilities/react-o11y.mdx +2 -2
- package/dist/xulux/catalog-client.d.ts.map +1 -1
- package/dist/xulux/catalog-client.js +51 -6
- package/dist/xulux/catalog-client.js.map +1 -1
- package/dist/xulux/types.d.ts +7 -7
- package/dist/xulux/types.d.ts.map +1 -1
- package/dist/xulux/types.js.map +1 -1
- package/package.json +3 -3
- package/src/tools/tests/docs.test.ts +10 -7
- package/src/tools/tests/path-traversal.test.ts +5 -2
- package/src/tools/tests/xulux-templates.test.ts +63 -0
- package/src/xulux/catalog-client.ts +68 -23
- package/src/xulux/types.ts +17 -13
- package/.docs/raw/docs/ui/accordion.mdx +0 -266
- package/.docs/raw/docs/ui/badge.mdx +0 -150
- package/.docs/raw/docs/ui/diff-viewer.mdx +0 -280
- package/.docs/raw/docs/ui/dot-matrix.mdx +0 -133
- package/.docs/raw/docs/ui/number-roll.mdx +0 -154
- package/.docs/raw/docs/ui/select.mdx +0 -254
- package/.docs/raw/docs/ui/tabs.mdx +0 -271
- /package/.docs/raw/docs/{(docs) → (getting-started)}/architecture.mdx +0 -0
- /package/.docs/raw/docs/{(docs) → (getting-started)}/base-ui.mdx +0 -0
- /package/.docs/raw/docs/{(docs) → (getting-started)}/cli.mdx +0 -0
- /package/.docs/raw/docs/{(docs) → (getting-started)}/llm.mdx +0 -0
- /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
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
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(
|
|
75
|
+
`Unsupported catalog version: ${String(version)}. Expected ${XULUX_MCP_CATALOG_VERSION}.`,
|
|
23
76
|
);
|
|
24
77
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
|
86
|
+
return result.data;
|
|
42
87
|
}
|
|
43
88
|
|
|
44
89
|
interface CacheEntry {
|
package/src/xulux/types.ts
CHANGED
|
@@ -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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
```
|