@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.
- package/.docs/organized/code-examples/waterfall.md +3 -3
- package/.docs/organized/code-examples/with-a2a.md +5 -4
- package/.docs/organized/code-examples/with-ag-ui.md +7 -6
- package/.docs/organized/code-examples/with-ai-sdk-v7.md +14 -13
- package/.docs/organized/code-examples/with-artifacts.md +12 -11
- package/.docs/organized/code-examples/with-assistant-transport.md +6 -5
- package/.docs/organized/code-examples/with-browser-extension.md +6 -6
- package/.docs/organized/code-examples/with-chain-of-thought.md +16 -14
- package/.docs/organized/code-examples/with-cloud-standalone.md +7 -7
- package/.docs/organized/code-examples/with-cloud.md +11 -10
- package/.docs/organized/code-examples/with-custom-thread-list.md +11 -10
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +14 -13
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +15 -14
- package/.docs/organized/code-examples/with-eve.md +6 -5
- package/.docs/organized/code-examples/with-expo.md +213 -36
- package/.docs/organized/code-examples/with-external-store.md +6 -5
- package/.docs/organized/code-examples/with-ffmpeg.md +11 -10
- package/.docs/organized/code-examples/with-generative-ui.md +263 -29
- package/.docs/organized/code-examples/with-google-adk.md +5 -4
- package/.docs/organized/code-examples/with-heat-graph.md +3 -3
- package/.docs/organized/code-examples/with-image-generation.md +8 -7
- package/.docs/organized/code-examples/with-interactables.md +11 -10
- package/.docs/organized/code-examples/with-langchain.md +10 -9
- package/.docs/organized/code-examples/with-langgraph.md +7 -6
- package/.docs/organized/code-examples/with-livekit.md +15 -14
- package/.docs/organized/code-examples/with-mcp.md +14 -12
- package/.docs/organized/code-examples/with-nuxt.md +511 -575
- package/.docs/organized/code-examples/with-opencode.md +4 -4
- package/.docs/organized/code-examples/with-openui.md +450 -0
- package/.docs/organized/code-examples/with-pi.md +6 -5
- package/.docs/organized/code-examples/with-react-hook-form.md +16 -13
- package/.docs/organized/code-examples/with-react-ink-web.md +65 -15
- package/.docs/organized/code-examples/with-react-ink.md +5 -4
- package/.docs/organized/code-examples/with-react-router.md +8 -7
- package/.docs/organized/code-examples/with-resumable-stream.md +13 -12
- package/.docs/organized/code-examples/with-store.md +3 -3
- package/.docs/organized/code-examples/with-svelte.md +415 -0
- package/.docs/organized/code-examples/with-sveltekit.md +1061 -0
- package/.docs/organized/code-examples/with-tanstack.md +10 -9
- package/.docs/organized/code-examples/with-tap-runtime.md +5 -4
- package/.docs/organized/code-examples/with-virtualized-thread.md +6 -5
- package/.docs/organized/code-examples/with-vue.md +2 -2
- package/.docs/raw/docs/{(docs) → (getting-started)}/cli.mdx +6 -1
- 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 +26 -26
- 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/generative-ui/slack.mdx +5 -1
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/teams.mdx +9 -2
- package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +2 -2
- package/.docs/raw/docs/(reference)/api-reference/integrations/{react-ai-sdk.mdx → ai-sdk.mdx} +43 -18
- package/.docs/raw/docs/(reference)/api-reference/integrations/eve.mdx +61 -2
- 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/tools/status.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 +32 -1
- package/.docs/raw/docs/(reference)/api-reference/voice/session.mdx +1 -1
- package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +10 -10
- package/.docs/raw/docs/cloud/ai-sdk.mdx +4 -2
- package/.docs/raw/docs/cloud/index.mdx +1 -1
- package/.docs/raw/docs/copilots/assistant-frame.mdx +19 -8
- package/.docs/raw/docs/guides/attachments.mdx +4 -4
- package/.docs/raw/docs/guides/branching.mdx +1 -1
- package/.docs/raw/docs/guides/chatgpt-subscription.mdx +1 -1
- package/.docs/raw/docs/guides/context-api.mdx +15 -17
- package/.docs/raw/docs/guides/dictation.mdx +2 -2
- package/.docs/raw/docs/guides/electron.mdx +1 -1
- package/.docs/raw/docs/guides/latex.mdx +1 -1
- package/.docs/raw/docs/guides/mentions.mdx +2 -0
- 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 +8 -5
- 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/ink/primitives.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 +149 -131
- package/.docs/raw/docs/migrations/toolkit-tools.mdx +2 -2
- package/.docs/raw/docs/migrations/v0-15.mdx +34 -0
- 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 +4 -2
- package/.docs/raw/docs/primitives/thread-list.mdx +1 -1
- package/.docs/raw/docs/primitives/thread.mdx +2 -2
- 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 +48 -6
- 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/claude-managed-agents.mdx +118 -0
- 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/stability.mdx +2 -1
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +73 -33
- package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +1 -1
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +6 -2
- package/.docs/raw/docs/runtimes/langchain.mdx +2 -2
- package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +4 -0
- package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +1 -1
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +9 -2
- package/.docs/raw/docs/tools/backend.mdx +4 -4
- package/.docs/raw/docs/tools/defining-tools.mdx +21 -2
- package/.docs/raw/docs/tools/generative-ui-primitive.mdx +180 -0
- package/.docs/raw/docs/tools/generative-ui-slack.mdx +167 -0
- package/.docs/raw/docs/tools/generative-ui-teams.mdx +160 -0
- package/.docs/raw/docs/tools/generative-ui.mdx +224 -211
- package/.docs/raw/docs/tools/index.mdx +2 -1
- package/.docs/raw/docs/tools/interactables.mdx +8 -7
- 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 +175 -0
- package/.docs/raw/docs/tools/tool-ui.mdx +18 -7
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +7 -3
- 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 +50 -3
- 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 +2 -2
- package/.docs/raw/docs/ui/follow-up-suggestions.mdx +1 -1
- package/.docs/raw/docs/ui/image.mdx +2 -2
- 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 +5 -5
- 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/tools/interactables-legacy.mdx +0 -423
- 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)}/llm.mdx +0 -0
- /package/.docs/raw/docs/{(docs) → (getting-started)}/rtl.mdx +0 -0
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Dot Matrix
|
|
3
|
-
description: Tiny 5x5 dot-matrix indicator with 20 state-specific blink patterns.
|
|
4
|
-
platforms: ["react"]
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
import { PreviewCode } from "@/components/docs/preview-code.server";
|
|
8
|
-
import {
|
|
9
|
-
DotMatrixSample,
|
|
10
|
-
DotMatrixLifecycleSample,
|
|
11
|
-
DotMatrixInlineSample,
|
|
12
|
-
DotMatrixSizesSample,
|
|
13
|
-
} from "@/components/docs/samples/dot-matrix";
|
|
14
|
-
|
|
15
|
-
<Callout>
|
|
16
|
-
This is a **standalone component** that does not depend on the assistant-ui runtime. Use it anywhere in your application.
|
|
17
|
-
</Callout>
|
|
18
|
-
|
|
19
|
-
<DotMatrixSample />
|
|
20
|
-
|
|
21
|
-
## Installation
|
|
22
|
-
|
|
23
|
-
<InstallCommand shadcn={["dot-matrix"]} />
|
|
24
|
-
|
|
25
|
-
This adds a `/components/assistant-ui/dot-matrix.tsx` file to your project, which you can adjust as needed. The component has no dependencies beyond React.
|
|
26
|
-
|
|
27
|
-
## Usage
|
|
28
|
-
|
|
29
|
-
```tsx
|
|
30
|
-
import { DotMatrix } from "@/components/assistant-ui/dot-matrix";
|
|
31
|
-
|
|
32
|
-
export function RunIndicator({ isRunning }: { isRunning: boolean }) {
|
|
33
|
-
return <DotMatrix state={isRunning ? "loading" : "success"} />;
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Dots inherit the surrounding text color, so the matrix renders dark dots on light backgrounds and light dots on dark backgrounds without configuration. Every state is a combination of a dot pattern, a motion, and a color, and switching states cross-fades each dot into its new pattern.
|
|
38
|
-
|
|
39
|
-
## States
|
|
40
|
-
|
|
41
|
-
| State | Pattern |
|
|
42
|
-
|-------|---------|
|
|
43
|
-
| `idle` | Dim static grid |
|
|
44
|
-
| `loading` | Randomized twinkle (default) |
|
|
45
|
-
| `thinking` | Diagonal wave |
|
|
46
|
-
| `streaming` | Falling rain, per-column streaks |
|
|
47
|
-
| `searching` | Horizontal sweep |
|
|
48
|
-
| `syncing` | Rotating sweep around the center |
|
|
49
|
-
| `connecting` | Ripple expanding from the center |
|
|
50
|
-
| `waiting` | Ellipsis dots blinking in sequence |
|
|
51
|
-
| `uploading` | Wave rising upward |
|
|
52
|
-
| `downloading` | Wave falling downward |
|
|
53
|
-
| `listening` | Slow equalizer columns |
|
|
54
|
-
| `speaking` | Fast equalizer columns |
|
|
55
|
-
| `recording` | Red center dot breathing |
|
|
56
|
-
| `success` | Green check glyph, static |
|
|
57
|
-
| `error` | Red cross glyph, blinking |
|
|
58
|
-
| `warning` | Amber exclamation glyph, slow blink |
|
|
59
|
-
| `info` | Blue info glyph, static |
|
|
60
|
-
| `paused` | Pause bars glyph, static |
|
|
61
|
-
| `stopped` | Square glyph, static |
|
|
62
|
-
| `offline` | Very dim static grid |
|
|
63
|
-
|
|
64
|
-
The component exports `dotMatrixStates` (the ordered list above) and the `DotMatrixState` union type, so UIs can enumerate or map states without duplicating the list. New states are added by extending the `STATES` record in the component source with a glyph and a per-dot blink function.
|
|
65
|
-
|
|
66
|
-
## Examples
|
|
67
|
-
|
|
68
|
-
### State Lifecycle
|
|
69
|
-
|
|
70
|
-
Drive the `state` prop from your run status; the matrix morphs between patterns instead of swapping components.
|
|
71
|
-
|
|
72
|
-
<PreviewCode file="components/docs/samples/dot-matrix" name="DotMatrixLifecycleSample">
|
|
73
|
-
<DotMatrixLifecycleSample />
|
|
74
|
-
</PreviewCode>
|
|
75
|
-
|
|
76
|
-
### Inline With Text
|
|
77
|
-
|
|
78
|
-
At the default `size-4` the matrix aligns with text like an icon, and the dots adapt to inverted surfaces through `currentColor`.
|
|
79
|
-
|
|
80
|
-
<PreviewCode file="components/docs/samples/dot-matrix" name="DotMatrixInlineSample">
|
|
81
|
-
<DotMatrixInlineSample />
|
|
82
|
-
</PreviewCode>
|
|
83
|
-
|
|
84
|
-
### Sizes
|
|
85
|
-
|
|
86
|
-
The matrix is an SVG, so any size utility scales it crisply.
|
|
87
|
-
|
|
88
|
-
<DotMatrixSizesSample />
|
|
89
|
-
|
|
90
|
-
## How It Works
|
|
91
|
-
|
|
92
|
-
The grid is a 5x5 SVG of `currentColor` circles. Blinking is a single CSS keyframe animation whose high/low opacity bounds come from registered per-dot CSS variables; the animation runs in every state (static states collapse the bounds) and the bounds carry a transition, which is what makes state changes cross-fade per dot. The randomized loading rhythm uses deterministic per-dot delays and durations, so server and client render identical markup and no JavaScript runs after render. With `prefers-reduced-motion`, the dots hold their resting opacity instead of blinking.
|
|
93
|
-
|
|
94
|
-
The root is a `role="status"` live region whose text content is the state name (or the `label` prop), so screen readers announce state changes; the SVG itself is `aria-hidden`.
|
|
95
|
-
|
|
96
|
-
## API Reference
|
|
97
|
-
|
|
98
|
-
### DotMatrix
|
|
99
|
-
|
|
100
|
-
<ParametersTable
|
|
101
|
-
type="DotMatrixProps"
|
|
102
|
-
parameters={[
|
|
103
|
-
{
|
|
104
|
-
name: "state",
|
|
105
|
-
type: "DotMatrixState",
|
|
106
|
-
default: '"loading"',
|
|
107
|
-
description:
|
|
108
|
-
"One of the 20 built-in states listed above, controlling pattern, motion, and color.",
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
name: "label",
|
|
112
|
-
type: "string",
|
|
113
|
-
description:
|
|
114
|
-
"Accessible label announced by screen readers. Defaults to the state name.",
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: "className",
|
|
118
|
-
type: "string",
|
|
119
|
-
description:
|
|
120
|
-
"Additional CSS classes. Use size utilities to scale and text color utilities to recolor.",
|
|
121
|
-
},
|
|
122
|
-
]}
|
|
123
|
-
/>
|
|
124
|
-
|
|
125
|
-
### Styling
|
|
126
|
-
|
|
127
|
-
Color follows `currentColor`, so `className="text-blue-500"` recolors the whole matrix; the outcome states (`success`, `error`, `warning`, `info`, `recording`, and the muted static states) set their own color which a `className` can override. Dots are targetable via `[data-slot="dot-matrix"]` and `[data-slot="dot-matrix-dot"]`, and the current state is exposed as `data-state` on the root.
|
|
128
|
-
|
|
129
|
-
## Related Components
|
|
130
|
-
|
|
131
|
-
- [Number Roll](/docs/ui/number-roll) - Animated rolling number
|
|
132
|
-
- [Badge](/docs/ui/badge) - Small status and metadata labels
|
|
133
|
-
- [Voice](/docs/ui/voice) - Voice activity visualization
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Number Roll
|
|
3
|
-
description: Animated number that rolls digits odometer-style when the value changes.
|
|
4
|
-
platforms: ["react"]
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
import { PreviewCode } from "@/components/docs/preview-code.server";
|
|
8
|
-
import {
|
|
9
|
-
NumberRollSample,
|
|
10
|
-
NumberRollCompactSample,
|
|
11
|
-
NumberRollFormatSample,
|
|
12
|
-
NumberRollLiveSample,
|
|
13
|
-
} from "@/components/docs/samples/number-roll";
|
|
14
|
-
|
|
15
|
-
<Callout>
|
|
16
|
-
This is a **standalone component** that does not depend on the assistant-ui runtime. Use it anywhere in your application.
|
|
17
|
-
</Callout>
|
|
18
|
-
|
|
19
|
-
<NumberRollSample />
|
|
20
|
-
|
|
21
|
-
## Installation
|
|
22
|
-
|
|
23
|
-
<InstallCommand shadcn={["number-roll"]} />
|
|
24
|
-
|
|
25
|
-
This adds a `/components/assistant-ui/number-roll.tsx` file to your project, which you can adjust as needed. The component has no dependencies beyond React.
|
|
26
|
-
|
|
27
|
-
## Usage
|
|
28
|
-
|
|
29
|
-
```tsx
|
|
30
|
-
import { NumberRoll } from "@/components/assistant-ui/number-roll";
|
|
31
|
-
|
|
32
|
-
export function TokenCounter({ count }: { count: number }) {
|
|
33
|
-
return <NumberRoll value={count} format={{ notation: "compact" }} />;
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
When `value` changes, each digit rolls in place to its new value. Formatting is handled by `Intl.NumberFormat`, so structural changes animate too: when `700` becomes `1.1K` with compact notation, the surviving ones digit rolls from 0 to 1 while the leading `70` slides out and the decimal point, fraction digit, and `K` suffix slide in.
|
|
38
|
-
|
|
39
|
-
## Examples
|
|
40
|
-
|
|
41
|
-
### Compact Notation
|
|
42
|
-
|
|
43
|
-
Pass any `Intl.NumberFormatOptions` via the `format` prop. Crossing a compact-notation threshold animates the formatting change instead of remounting the whole string.
|
|
44
|
-
|
|
45
|
-
<PreviewCode file="components/docs/samples/number-roll" name="NumberRollCompactSample">
|
|
46
|
-
<NumberRollCompactSample />
|
|
47
|
-
</PreviewCode>
|
|
48
|
-
|
|
49
|
-
### Formats and Locales
|
|
50
|
-
|
|
51
|
-
Currencies, percentages, suffixes, and non-English locales all work through the same `Intl.NumberFormat` pipeline. Compact thresholds and suffixes are locale-dependent (`1.2万` in `zh-CN`), so never hardcode them.
|
|
52
|
-
|
|
53
|
-
<PreviewCode file="components/docs/samples/number-roll" name="NumberRollFormatSample">
|
|
54
|
-
<NumberRollFormatSample />
|
|
55
|
-
</PreviewCode>
|
|
56
|
-
|
|
57
|
-
### Live Counter
|
|
58
|
-
|
|
59
|
-
Rapid successive updates retarget the in-flight roll smoothly, which makes the component suitable for streaming token counts and other live metrics.
|
|
60
|
-
|
|
61
|
-
<PreviewCode file="components/docs/samples/number-roll" name="NumberRollLiveSample">
|
|
62
|
-
<NumberRollLiveSample />
|
|
63
|
-
</PreviewCode>
|
|
64
|
-
|
|
65
|
-
## How It Works
|
|
66
|
-
|
|
67
|
-
The value is formatted with `Intl.NumberFormat.formatToParts` and split into keyed parts. Integer digits are keyed by place value counted from the right, so when `999` becomes `1,000` the existing columns keep their identity and roll in place while only the new leading digit and separator enter. Symbols (decimal point, group separators, currency signs, compact suffixes) cross-fade and collapse via animated `grid-template-columns`.
|
|
68
|
-
|
|
69
|
-
Each digit renders a strip of 0 to 9 and animates a registered CSS custom property; CSS `mod()` math wraps the strip into an endless ribbon, so rolling from 9 to 0 continues in the trend direction instead of spinning backwards. There is no JavaScript animation loop and no animation library dependency.
|
|
70
|
-
|
|
71
|
-
In browsers without CSS `mod()` support, and during server rendering, the component renders the plain formatted string. With `prefers-reduced-motion`, values swap instantly without rolling. When server rendering, pass an explicit `locales`: the server's default locale can differ from the visitor's browser locale, and a mismatched formatted string causes a React hydration error. Locales whose default numbering system is non-Latin (such as `ar-EG`) cross-fade their digits as symbols instead of rolling.
|
|
72
|
-
|
|
73
|
-
The formatted value is exposed to screen readers as plain text while the animated digits are `aria-hidden`. Value changes are not announced automatically; wrap the component in an `aria-live` region if you need announcements.
|
|
74
|
-
|
|
75
|
-
## API Reference
|
|
76
|
-
|
|
77
|
-
### NumberRoll
|
|
78
|
-
|
|
79
|
-
<ParametersTable
|
|
80
|
-
type="NumberRollProps"
|
|
81
|
-
parameters={[
|
|
82
|
-
{
|
|
83
|
-
name: "value",
|
|
84
|
-
type: "number",
|
|
85
|
-
required: true,
|
|
86
|
-
description: "The number to display.",
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
name: "format",
|
|
90
|
-
type: "Intl.NumberFormatOptions",
|
|
91
|
-
description:
|
|
92
|
-
"Number formatting options, e.g. `{ notation: \"compact\" }` or `{ style: \"currency\", currency: \"USD\" }`.",
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
name: "locales",
|
|
96
|
-
type: "Intl.LocalesArgument",
|
|
97
|
-
description:
|
|
98
|
-
"Locale(s) passed to `Intl.NumberFormat`. Pass an explicit value in server-rendered apps so the server and client format identically.",
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: "prefix",
|
|
102
|
-
type: "string",
|
|
103
|
-
description: "Static text rendered before the number.",
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
name: "suffix",
|
|
107
|
-
type: "string",
|
|
108
|
-
description: "Static text rendered after the number.",
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
name: "trend",
|
|
112
|
-
type: '"auto" | "up" | "down"',
|
|
113
|
-
default: '"auto"',
|
|
114
|
-
description:
|
|
115
|
-
"Roll direction. `auto` follows the sign of the value change; `up` and `down` force a direction, wrapping digits through 9/0 as needed.",
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
name: "duration",
|
|
119
|
-
type: "number",
|
|
120
|
-
default: "500",
|
|
121
|
-
description:
|
|
122
|
-
"Digit roll duration in milliseconds. Enter/exit fades run at 60% of this value.",
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
name: "className",
|
|
126
|
-
type: "string",
|
|
127
|
-
description: "Additional CSS classes.",
|
|
128
|
-
},
|
|
129
|
-
]}
|
|
130
|
-
/>
|
|
131
|
-
|
|
132
|
-
### Styling
|
|
133
|
-
|
|
134
|
-
The root applies `tabular-nums` so digits keep a constant width while rolling; the font you use must provide tabular figures for the layout to stay stable. Size and color are inherited from the surrounding text, so style it like any span:
|
|
135
|
-
|
|
136
|
-
```tsx
|
|
137
|
-
<NumberRoll value={value} className="text-4xl font-semibold" />
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
Change the animation speed via the `duration` prop; it drives both the CSS timing and the cleanup that unmounts exited characters, so overriding the duration variable in CSS alone would remove them mid-fade. The fade and easing variables are safe to override via the `style` prop (the defaults are set as inline styles, so plain `className` overrides do not apply):
|
|
141
|
-
|
|
142
|
-
| Variable | Default | Description |
|
|
143
|
-
|----------|---------|-------------|
|
|
144
|
-
| `--aui-number-roll-duration` | `500ms` (from the `duration` prop) | Digit roll duration. |
|
|
145
|
-
| `--aui-number-roll-fade` | 60% of the duration | Enter/exit fade and width-collapse duration. |
|
|
146
|
-
| `--aui-number-roll-ease` | `cubic-bezier(0.23, 1, 0.32, 1)` | Digit roll easing. |
|
|
147
|
-
|
|
148
|
-
Parts are targetable via data attributes: `[data-slot="number-roll"]`, `[data-slot="number-roll-part"]`, `[data-slot="number-roll-digit"]`, and `[data-slot="number-roll-symbol"]`.
|
|
149
|
-
|
|
150
|
-
## Related Components
|
|
151
|
-
|
|
152
|
-
- [Context Display](/docs/ui/context-display) - Live token usage ring and bar
|
|
153
|
-
- [Message Timing](/docs/ui/message-timing) - Streaming stats badge
|
|
154
|
-
- [Badge](/docs/ui/badge) - Small status and metadata labels
|
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Select
|
|
3
|
-
description: A dropdown select component with composable sub-components.
|
|
4
|
-
links:
|
|
5
|
-
- label: Radix UI Select (Radix styles)
|
|
6
|
-
url: https://www.radix-ui.com/primitives/docs/components/select
|
|
7
|
-
- label: Base UI Select (base styles)
|
|
8
|
-
url: https://base-ui.com/react/components/select
|
|
9
|
-
platforms: ["react"]
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
import { PreviewCode } from "@/components/docs/preview-code.server";
|
|
13
|
-
import {
|
|
14
|
-
SelectSample,
|
|
15
|
-
SelectDisabledItemsSample,
|
|
16
|
-
SelectPlaceholderSample,
|
|
17
|
-
SelectDisabledSample,
|
|
18
|
-
SelectGroupsSample,
|
|
19
|
-
SelectVariantsSample,
|
|
20
|
-
SelectSizesSample,
|
|
21
|
-
SelectScrollableSample,
|
|
22
|
-
} from "@/components/docs/samples/select";
|
|
23
|
-
import * as SelectRadixSamples from "@/components/docs/samples/select.radix";
|
|
24
|
-
import { Flavored, FlavorSwitcher } from "@/components/docs/contexts/flavor.server";
|
|
25
|
-
|
|
26
|
-
<Callout>
|
|
27
|
-
This is a **standalone component** that does not depend on the assistant-ui runtime. Use it anywhere in your application.
|
|
28
|
-
</Callout>
|
|
29
|
-
|
|
30
|
-
<FlavorSwitcher />
|
|
31
|
-
|
|
32
|
-
<Flavored radix={<SelectRadixSamples.SelectSample />} base={<SelectSample />} />
|
|
33
|
-
|
|
34
|
-
## Installation
|
|
35
|
-
|
|
36
|
-
<InstallCommand shadcn={["select"]} />
|
|
37
|
-
|
|
38
|
-
## Usage
|
|
39
|
-
|
|
40
|
-
```tsx
|
|
41
|
-
import { Select } from "@/components/assistant-ui/select";
|
|
42
|
-
|
|
43
|
-
const options = [
|
|
44
|
-
{ value: "apple", label: "Apple" },
|
|
45
|
-
{ value: "banana", label: "Banana" },
|
|
46
|
-
{ value: "orange", label: "Orange" },
|
|
47
|
-
];
|
|
48
|
-
|
|
49
|
-
export function FruitPicker() {
|
|
50
|
-
const [value, setValue] = useState("apple");
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<Select
|
|
54
|
-
value={value}
|
|
55
|
-
onValueChange={setValue}
|
|
56
|
-
options={options}
|
|
57
|
-
placeholder="Select a fruit..."
|
|
58
|
-
/>
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## Examples
|
|
64
|
-
|
|
65
|
-
### Variants
|
|
66
|
-
|
|
67
|
-
Use the `variant` prop on `SelectTrigger` to change the visual style.
|
|
68
|
-
|
|
69
|
-
<Flavored radix={<SelectRadixSamples.SelectVariantsSample />} base={<SelectVariantsSample />} />
|
|
70
|
-
|
|
71
|
-
```tsx
|
|
72
|
-
<SelectTrigger variant="outline" /> // Border (default)
|
|
73
|
-
<SelectTrigger variant="ghost" /> // No border
|
|
74
|
-
<SelectTrigger variant="muted" /> // Solid background
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Sizes
|
|
78
|
-
|
|
79
|
-
Use the `size` prop on `SelectTrigger` to change the height.
|
|
80
|
-
|
|
81
|
-
<Flavored radix={<SelectRadixSamples.SelectSizesSample />} base={<SelectSizesSample />} />
|
|
82
|
-
|
|
83
|
-
```tsx
|
|
84
|
-
<SelectTrigger size="default" /> // 36px (default)
|
|
85
|
-
<SelectTrigger size="sm" /> // 32px
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### Scrollable
|
|
89
|
-
|
|
90
|
-
Long lists automatically become scrollable.
|
|
91
|
-
|
|
92
|
-
<PreviewCode file="components/docs/samples/select" name="SelectScrollableSample" base={<SelectScrollableSample />}>
|
|
93
|
-
<SelectRadixSamples.SelectScrollableSample />
|
|
94
|
-
</PreviewCode>
|
|
95
|
-
|
|
96
|
-
### Groups
|
|
97
|
-
|
|
98
|
-
Use the composable API for grouped options:
|
|
99
|
-
|
|
100
|
-
<PreviewCode file="components/docs/samples/select" name="SelectGroupsSample" base={<SelectGroupsSample />}>
|
|
101
|
-
<SelectRadixSamples.SelectGroupsSample />
|
|
102
|
-
</PreviewCode>
|
|
103
|
-
|
|
104
|
-
### Disabled Items
|
|
105
|
-
|
|
106
|
-
<PreviewCode file="components/docs/samples/select" name="SelectDisabledItemsSample" base={<SelectDisabledItemsSample />}>
|
|
107
|
-
<SelectRadixSamples.SelectDisabledItemsSample />
|
|
108
|
-
</PreviewCode>
|
|
109
|
-
|
|
110
|
-
### With Placeholder
|
|
111
|
-
|
|
112
|
-
<PreviewCode file="components/docs/samples/select" name="SelectPlaceholderSample" base={<SelectPlaceholderSample />}>
|
|
113
|
-
<SelectRadixSamples.SelectPlaceholderSample />
|
|
114
|
-
</PreviewCode>
|
|
115
|
-
|
|
116
|
-
### Disabled Select
|
|
117
|
-
|
|
118
|
-
<PreviewCode file="components/docs/samples/select" name="SelectDisabledSample" base={<SelectDisabledSample />}>
|
|
119
|
-
<SelectRadixSamples.SelectDisabledSample />
|
|
120
|
-
</PreviewCode>
|
|
121
|
-
|
|
122
|
-
## API Reference
|
|
123
|
-
|
|
124
|
-
### Composable API
|
|
125
|
-
|
|
126
|
-
| Component | Description |
|
|
127
|
-
|-----------|-------------|
|
|
128
|
-
| `Select` | A convenience component that renders a complete select with options. |
|
|
129
|
-
| `SelectRoot` | The root component that manages state. |
|
|
130
|
-
| `SelectTrigger` | The button that opens the dropdown. Accepts `variant` and `size` props. |
|
|
131
|
-
| `SelectValue` | Renders the selected value or placeholder. |
|
|
132
|
-
| `SelectContent` | The dropdown content container with animations. |
|
|
133
|
-
| `SelectItem` | An individual selectable item. |
|
|
134
|
-
| `SelectGroup` | Groups related items together. |
|
|
135
|
-
| `SelectLabel` | A label for a group of items. |
|
|
136
|
-
| `SelectSeparator` | A visual separator between items or groups. |
|
|
137
|
-
| `SelectScrollUpButton` | Scroll indicator for long lists. |
|
|
138
|
-
| `SelectScrollDownButton` | Scroll indicator for long lists. |
|
|
139
|
-
|
|
140
|
-
With the Base UI flavor, `SelectValue` resolves the trigger label from the `items` prop on `SelectRoot`; pass the same array you map into `SelectItem` children. The Radix flavor reads the label from the selected item's text automatically.
|
|
141
|
-
|
|
142
|
-
### Select
|
|
143
|
-
|
|
144
|
-
A convenience component that renders a complete select with options.
|
|
145
|
-
|
|
146
|
-
<ParametersTable
|
|
147
|
-
type="SelectProps"
|
|
148
|
-
parameters={[
|
|
149
|
-
{
|
|
150
|
-
name: "value",
|
|
151
|
-
type: "string",
|
|
152
|
-
required: true,
|
|
153
|
-
description: "The controlled value of the select.",
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
name: "onValueChange",
|
|
157
|
-
type: "(value: string) => void",
|
|
158
|
-
required: true,
|
|
159
|
-
description: "Callback when the selected value changes.",
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
name: "options",
|
|
163
|
-
type: "SelectOption[]",
|
|
164
|
-
required: true,
|
|
165
|
-
description: "Array of options to display.",
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
name: "placeholder",
|
|
169
|
-
type: "string",
|
|
170
|
-
description: "Placeholder text when no value is selected.",
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
name: "className",
|
|
174
|
-
type: "string",
|
|
175
|
-
description: "Additional CSS classes for the trigger.",
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
name: "disabled",
|
|
179
|
-
type: "boolean",
|
|
180
|
-
description: "Whether the select is disabled.",
|
|
181
|
-
},
|
|
182
|
-
]}
|
|
183
|
-
/>
|
|
184
|
-
|
|
185
|
-
### SelectOption
|
|
186
|
-
|
|
187
|
-
<ParametersTable
|
|
188
|
-
type="SelectOption"
|
|
189
|
-
parameters={[
|
|
190
|
-
{
|
|
191
|
-
name: "value",
|
|
192
|
-
type: "string",
|
|
193
|
-
required: true,
|
|
194
|
-
description: "The value of the option.",
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
name: "label",
|
|
198
|
-
type: "ReactNode",
|
|
199
|
-
required: true,
|
|
200
|
-
description: "The display label for the option.",
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
name: "textValue",
|
|
204
|
-
type: "string",
|
|
205
|
-
description: "Optional text value for typeahead. Defaults to label if it's a string.",
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
name: "disabled",
|
|
209
|
-
type: "boolean",
|
|
210
|
-
description: "Whether the option is disabled.",
|
|
211
|
-
},
|
|
212
|
-
]}
|
|
213
|
-
/>
|
|
214
|
-
|
|
215
|
-
### SelectTrigger
|
|
216
|
-
|
|
217
|
-
The button that opens the dropdown.
|
|
218
|
-
|
|
219
|
-
<ParametersTable
|
|
220
|
-
type="SelectTriggerProps"
|
|
221
|
-
parameters={[
|
|
222
|
-
{
|
|
223
|
-
name: "variant",
|
|
224
|
-
type: '"outline" | "ghost" | "muted"',
|
|
225
|
-
default: '"outline"',
|
|
226
|
-
description: "The visual style of the trigger.",
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
name: "size",
|
|
230
|
-
type: '"sm" | "default" | "lg"',
|
|
231
|
-
default: '"default"',
|
|
232
|
-
description: "The size of the trigger.",
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
name: "className",
|
|
236
|
-
type: "string",
|
|
237
|
-
description: "Additional CSS classes.",
|
|
238
|
-
},
|
|
239
|
-
]}
|
|
240
|
-
/>
|
|
241
|
-
|
|
242
|
-
### Style Variants (CVA)
|
|
243
|
-
|
|
244
|
-
| Export | Description |
|
|
245
|
-
|--------|-------------|
|
|
246
|
-
| `selectTriggerVariants` | Styles for the select trigger button. |
|
|
247
|
-
|
|
248
|
-
```tsx
|
|
249
|
-
import { selectTriggerVariants } from "@/components/assistant-ui/select";
|
|
250
|
-
|
|
251
|
-
<button className={selectTriggerVariants({ variant: "ghost", size: "sm" })}>
|
|
252
|
-
Custom Trigger
|
|
253
|
-
</button>
|
|
254
|
-
```
|