@assistant-ui/mcp-docs-server 0.1.24 → 0.1.26

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 (151) hide show
  1. package/.docs/organized/code-examples/waterfall.md +8 -6
  2. package/.docs/organized/code-examples/with-a2a.md +676 -0
  3. package/.docs/organized/code-examples/with-ag-ui.md +10 -11
  4. package/.docs/organized/code-examples/with-ai-sdk-v6.md +31 -19
  5. package/.docs/organized/code-examples/with-artifacts.md +8 -8
  6. package/.docs/organized/code-examples/with-assistant-transport.md +6 -6
  7. package/.docs/organized/code-examples/with-chain-of-thought.md +37 -29
  8. package/.docs/organized/code-examples/with-cloud-standalone.md +14 -11
  9. package/.docs/organized/code-examples/with-cloud.md +8 -8
  10. package/.docs/organized/code-examples/with-custom-thread-list.md +10 -10
  11. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +11 -11
  12. package/.docs/organized/code-examples/with-expo.md +571 -520
  13. package/.docs/organized/code-examples/with-external-store.md +6 -6
  14. package/.docs/organized/code-examples/with-ffmpeg.md +8 -8
  15. package/.docs/organized/code-examples/with-google-adk.md +353 -0
  16. package/.docs/organized/code-examples/with-heat-graph.md +304 -0
  17. package/.docs/organized/code-examples/with-interactables.md +778 -0
  18. package/.docs/organized/code-examples/with-langgraph.md +28 -26
  19. package/.docs/organized/code-examples/with-parent-id-grouping.md +7 -7
  20. package/.docs/organized/code-examples/with-react-hook-form.md +9 -9
  21. package/.docs/organized/code-examples/with-react-ink.md +265 -0
  22. package/.docs/organized/code-examples/with-react-router.md +12 -12
  23. package/.docs/organized/code-examples/with-store.md +33 -22
  24. package/.docs/organized/code-examples/with-tanstack.md +10 -10
  25. package/.docs/organized/code-examples/with-tap-runtime.md +12 -10
  26. package/.docs/raw/blog/2025-01-31-changelog/index.mdx +1 -1
  27. package/.docs/raw/blog/2026-03-launch-week/index.mdx +258 -0
  28. package/.docs/raw/docs/(docs)/architecture.mdx +1 -1
  29. package/.docs/raw/docs/(docs)/cli.mdx +74 -9
  30. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +8 -3
  31. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +5 -1
  32. package/.docs/raw/docs/(docs)/copilots/{make-assistant-readable.mdx → make-assistant-visible.mdx} +14 -5
  33. package/.docs/raw/docs/(docs)/copilots/model-context.mdx +11 -11
  34. package/.docs/raw/docs/(docs)/copilots/motivation.mdx +2 -2
  35. package/.docs/raw/docs/(docs)/devtools.mdx +3 -2
  36. package/.docs/raw/docs/(docs)/guides/attachments.mdx +74 -15
  37. package/.docs/raw/docs/(docs)/guides/branching.mdx +11 -6
  38. package/.docs/raw/docs/(docs)/guides/chain-of-thought.mdx +18 -16
  39. package/.docs/raw/docs/(docs)/guides/context-api.mdx +81 -43
  40. package/.docs/raw/docs/(docs)/guides/dictation.mdx +5 -5
  41. package/.docs/raw/docs/(docs)/guides/editing.mdx +16 -7
  42. package/.docs/raw/docs/(docs)/guides/interactables.mdx +292 -0
  43. package/.docs/raw/docs/(docs)/guides/latex.mdx +3 -0
  44. package/.docs/raw/docs/(docs)/guides/message-timing.mdx +5 -4
  45. package/.docs/raw/docs/(docs)/guides/multi-agent.mdx +174 -0
  46. package/.docs/raw/docs/(docs)/guides/quoting.mdx +55 -206
  47. package/.docs/raw/docs/(docs)/guides/speech.mdx +1 -4
  48. package/.docs/raw/docs/(docs)/guides/suggestions.mdx +9 -15
  49. package/.docs/raw/docs/(docs)/guides/tool-ui.mdx +17 -7
  50. package/.docs/raw/docs/(docs)/guides/tools.mdx +24 -9
  51. package/.docs/raw/docs/(docs)/index.mdx +3 -3
  52. package/.docs/raw/docs/(docs)/installation.mdx +69 -46
  53. package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx +20 -6
  54. package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +24 -4
  55. package/.docs/raw/docs/(reference)/api-reference/integrations/react-hook-form.mdx +1 -1
  56. package/.docs/raw/docs/(reference)/api-reference/integrations/vercel-ai-sdk.mdx +20 -19
  57. package/.docs/raw/docs/(reference)/api-reference/overview.mdx +28 -53
  58. package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +4 -4
  59. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +7 -1
  60. package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +20 -14
  61. package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +1 -1
  62. package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +226 -44
  63. package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +52 -40
  64. package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +343 -23
  65. package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +4 -6
  66. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +4 -2
  67. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +3 -5
  68. package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +169 -22
  69. package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +14 -4
  70. package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +15 -26
  71. package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +39 -21
  72. package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +33 -9
  73. package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +48 -21
  74. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +36 -7
  75. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +30 -10
  76. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +12 -10
  77. package/.docs/raw/docs/(reference)/migrations/deprecation-policy.mdx +1 -1
  78. package/.docs/raw/docs/(reference)/migrations/react-langgraph-v0-7.mdx +9 -4
  79. package/.docs/raw/docs/(reference)/migrations/v0-11.mdx +7 -5
  80. package/.docs/raw/docs/(reference)/migrations/v0-12.mdx +9 -7
  81. package/.docs/raw/docs/(reference)/migrations/v0-14.mdx +159 -0
  82. package/.docs/raw/docs/(reference)/react-compatibility.mdx +5 -134
  83. package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +90 -6
  84. package/.docs/raw/docs/cloud/ai-sdk.mdx +95 -5
  85. package/.docs/raw/docs/cloud/langgraph.mdx +13 -3
  86. package/.docs/raw/docs/ink/adapters.mdx +41 -0
  87. package/.docs/raw/docs/ink/custom-backend.mdx +203 -0
  88. package/.docs/raw/docs/ink/hooks.mdx +448 -0
  89. package/.docs/raw/docs/ink/index.mdx +239 -0
  90. package/.docs/raw/docs/ink/migration.mdx +140 -0
  91. package/.docs/raw/docs/ink/primitives.mdx +840 -0
  92. package/.docs/raw/docs/primitives/action-bar.mdx +351 -0
  93. package/.docs/raw/docs/primitives/assistant-modal.mdx +215 -0
  94. package/.docs/raw/docs/primitives/attachment.mdx +216 -0
  95. package/.docs/raw/docs/primitives/branch-picker.mdx +221 -0
  96. package/.docs/raw/docs/primitives/chain-of-thought.mdx +311 -0
  97. package/.docs/raw/docs/primitives/composer.mdx +526 -0
  98. package/.docs/raw/docs/primitives/error.mdx +141 -0
  99. package/.docs/raw/docs/primitives/index.mdx +98 -0
  100. package/.docs/raw/docs/primitives/message.mdx +524 -0
  101. package/.docs/raw/docs/primitives/selection-toolbar.mdx +165 -0
  102. package/.docs/raw/docs/primitives/suggestion.mdx +242 -0
  103. package/.docs/raw/docs/primitives/thread-list.mdx +404 -0
  104. package/.docs/raw/docs/primitives/thread.mdx +482 -0
  105. package/.docs/raw/docs/react-native/adapters.mdx +63 -87
  106. package/.docs/raw/docs/react-native/custom-backend.mdx +11 -14
  107. package/.docs/raw/docs/react-native/hooks.mdx +214 -232
  108. package/.docs/raw/docs/react-native/index.mdx +118 -159
  109. package/.docs/raw/docs/react-native/migration.mdx +144 -0
  110. package/.docs/raw/docs/react-native/primitives.mdx +431 -302
  111. package/.docs/raw/docs/runtimes/a2a/index.mdx +294 -0
  112. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +9 -9
  113. package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +14 -3
  114. package/.docs/raw/docs/runtimes/assistant-transport.mdx +59 -25
  115. package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +13 -6
  116. package/.docs/raw/docs/runtimes/custom/external-store.mdx +138 -38
  117. package/.docs/raw/docs/runtimes/custom/local.mdx +184 -42
  118. package/.docs/raw/docs/runtimes/data-stream.mdx +92 -19
  119. package/.docs/raw/docs/runtimes/google-adk/index.mdx +624 -0
  120. package/.docs/raw/docs/runtimes/helicone.mdx +6 -6
  121. package/.docs/raw/docs/runtimes/langgraph/index.mdx +38 -27
  122. package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +1 -1
  123. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +15 -20
  124. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +7 -11
  125. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +8 -11
  126. package/.docs/raw/docs/runtimes/langserve.mdx +6 -7
  127. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +18 -3
  128. package/.docs/raw/docs/ui/file.mdx +5 -4
  129. package/.docs/raw/docs/ui/image.mdx +5 -4
  130. package/.docs/raw/docs/ui/markdown.mdx +3 -1
  131. package/.docs/raw/docs/ui/mention.mdx +168 -0
  132. package/.docs/raw/docs/ui/model-selector.mdx +8 -8
  133. package/.docs/raw/docs/ui/part-grouping.mdx +7 -10
  134. package/.docs/raw/docs/ui/quote.mdx +210 -0
  135. package/.docs/raw/docs/ui/reasoning.mdx +12 -11
  136. package/.docs/raw/docs/ui/sources.mdx +88 -17
  137. package/.docs/raw/docs/ui/streamdown.mdx +16 -7
  138. package/.docs/raw/docs/ui/thread-list.mdx +11 -13
  139. package/.docs/raw/docs/ui/thread.mdx +28 -33
  140. package/.docs/raw/docs/ui/tool-fallback.mdx +5 -6
  141. package/.docs/raw/docs/ui/tool-group.mdx +9 -8
  142. package/.docs/raw/docs/utilities/heat-graph.mdx +236 -0
  143. package/.docs/raw/docs/utilities/tw-shimmer.mdx +211 -0
  144. package/package.json +5 -5
  145. package/.docs/raw/docs/(reference)/legacy/styled/assistant-modal.mdx +0 -77
  146. package/.docs/raw/docs/(reference)/legacy/styled/decomposition.mdx +0 -635
  147. package/.docs/raw/docs/(reference)/legacy/styled/markdown.mdx +0 -77
  148. package/.docs/raw/docs/(reference)/legacy/styled/scrollbar.mdx +0 -72
  149. package/.docs/raw/docs/(reference)/legacy/styled/thread-width.mdx +0 -22
  150. package/.docs/raw/docs/(reference)/legacy/styled/thread.mdx +0 -77
  151. /package/.docs/raw/docs/cloud/{overview.mdx → index.mdx} +0 -0
@@ -0,0 +1,165 @@
1
+ ---
2
+ title: SelectionToolbar
3
+ description: A floating toolbar that appears when text is selected within a message.
4
+ ---
5
+
6
+ import { SelectionToolbarPrimitiveSample } from "@/components/docs/samples/selection-toolbar-primitive";
7
+
8
+ The SelectionToolbar primitive is a floating toolbar that appears when the user selects text within a message. It lets users quote selected text into the composer. Styling and action layout are fully customizable.
9
+
10
+ <Tabs items={["Preview", "Code"]}>
11
+ <Tab>
12
+ <SelectionToolbarPrimitiveSample />
13
+ </Tab>
14
+ <Tab>
15
+ ```tsx
16
+ import { SelectionToolbarPrimitive } from "@assistant-ui/react";
17
+ import { QuoteIcon } from "lucide-react";
18
+
19
+ function FloatingSelectionToolbar() {
20
+ return (
21
+ <SelectionToolbarPrimitive.Root className="flex items-center gap-1 rounded-lg border bg-popover px-1 py-1 shadow-md">
22
+ <SelectionToolbarPrimitive.Quote className="flex items-center gap-1.5 rounded-md px-2.5 py-1 text-popover-foreground text-sm hover:bg-accent">
23
+ <QuoteIcon className="size-3.5" />
24
+ Quote
25
+ </SelectionToolbarPrimitive.Quote>
26
+ </SelectionToolbarPrimitive.Root>
27
+ );
28
+ }
29
+ ```
30
+ </Tab>
31
+ </Tabs>
32
+
33
+ ## Quick Start
34
+
35
+ A minimal selection toolbar:
36
+
37
+ ```tsx
38
+ import { SelectionToolbarPrimitive } from "@assistant-ui/react";
39
+
40
+ <SelectionToolbarPrimitive.Root>
41
+ <SelectionToolbarPrimitive.Quote>
42
+ Quote
43
+ </SelectionToolbarPrimitive.Quote>
44
+ </SelectionToolbarPrimitive.Root>
45
+ ```
46
+
47
+ `Root` renders a `<div>` inside a portal, positioned above the text selection. `Quote` renders a `<button>` that copies the selected text into the composer as a quote.
48
+
49
+ <Callout type="info">
50
+ Runtime setup: primitives require runtime context. Wrap your UI in `AssistantRuntimeProvider` with a runtime (for example `useLocalRuntime(...)`). See [Pick a Runtime](/docs/runtimes/pick-a-runtime).
51
+ </Callout>
52
+
53
+ ## Core Concepts
54
+
55
+ ### Automatic Positioning
56
+
57
+ `Root` renders via a portal to `document.body`. In the current implementation, it positions itself with `position: fixed`, `top: rect.top - 8px`, `left: rect.left + rect.width / 2`, `transform: translate(-50%, -100%)` (placing it centered above the selection), and `z-index: 50`.
58
+
59
+ ### Single-Message Validation
60
+
61
+ The toolbar only appears when the selection is entirely within a single message. Cross-message selections are ignored. Detection works by checking for `data-message-id` attributes on ancestor elements, which `MessagePrimitive.Root` sets automatically.
62
+
63
+ `Root` returns `null` when there is no valid selection (collapsed selection, empty text, or no single-message match).
64
+
65
+ ### Quote Action
66
+
67
+ The `Quote` button does two things on click:
68
+
69
+ 1. Calls `composer.setQuote({ text, messageId })` to populate the composer with the selected text as a quoted snippet
70
+ 2. Clears the browser selection via `window.getSelection()?.removeAllRanges()`
71
+
72
+ The composer then shows the quoted text, and the user can type a follow-up message around it.
73
+
74
+ ### Dismissal
75
+
76
+ The toolbar hides automatically when:
77
+
78
+ - The user scrolls
79
+ - The selection collapses (click away or arrow keys)
80
+ - The selection is cleared programmatically (e.g., after quoting)
81
+
82
+ Clicking the toolbar itself does not dismiss the selection. `Root` calls `preventDefault` on `mousedown` to preserve it.
83
+
84
+ ### Placement in Thread
85
+
86
+ The SelectionToolbar must be placed inside `ThreadPrimitive.Root` but **outside** `ThreadPrimitive.Viewport`. It positions itself via a portal based on the browser selection, independent of the scroll container:
87
+
88
+ ```tsx
89
+ <ThreadPrimitive.Root>
90
+ <ThreadPrimitive.Viewport>
91
+ <ThreadPrimitive.Messages ... />
92
+ </ThreadPrimitive.Viewport>
93
+ <SelectionToolbarPrimitive.Root>
94
+ <SelectionToolbarPrimitive.Quote>Quote</SelectionToolbarPrimitive.Quote>
95
+ </SelectionToolbarPrimitive.Root>
96
+ <ComposerPrimitive.Root>...</ComposerPrimitive.Root>
97
+ </ThreadPrimitive.Root>
98
+ ```
99
+
100
+ ## Parts
101
+
102
+ ### Root
103
+
104
+ Floating toolbar container that appears for a valid text selection. Renders a `<div>` element unless `asChild` is set.
105
+
106
+ ```tsx
107
+ <SelectionToolbarPrimitive.Root className="flex items-center gap-1 rounded-lg border bg-popover px-1 py-1 shadow-md">
108
+ <SelectionToolbarPrimitive.Quote>Quote</SelectionToolbarPrimitive.Quote>
109
+ </SelectionToolbarPrimitive.Root>
110
+ ```
111
+
112
+ ### Quote
113
+
114
+ Quotes the currently selected text into the composer. Renders a `<button>` element unless `asChild` is set.
115
+
116
+ ```tsx
117
+ <SelectionToolbarPrimitive.Quote className="rounded-md px-2.5 py-1 text-sm hover:bg-accent">
118
+ Quote
119
+ </SelectionToolbarPrimitive.Quote>
120
+ ```
121
+
122
+ ## Patterns
123
+
124
+ ### Basic Toolbar with Quote
125
+
126
+ ```tsx
127
+ <SelectionToolbarPrimitive.Root className="flex items-center gap-1 rounded-lg border bg-popover px-1 py-1 shadow-md">
128
+ <SelectionToolbarPrimitive.Quote className="flex items-center gap-1.5 rounded-md px-2.5 py-1 text-sm text-popover-foreground hover:bg-accent">
129
+ <QuoteIcon className="size-3.5" />
130
+ Quote
131
+ </SelectionToolbarPrimitive.Quote>
132
+ </SelectionToolbarPrimitive.Root>
133
+ ```
134
+
135
+ ### Toolbar with Multiple Actions
136
+
137
+ You can add custom buttons alongside `Quote` for additional actions:
138
+
139
+ ```tsx
140
+ <SelectionToolbarPrimitive.Root className="flex items-center gap-1 rounded-lg border bg-popover px-1 py-1 shadow-md">
141
+ <SelectionToolbarPrimitive.Quote className="flex items-center gap-1.5 rounded-md px-2.5 py-1 text-sm hover:bg-accent">
142
+ <QuoteIcon className="size-3.5" />
143
+ Quote
144
+ </SelectionToolbarPrimitive.Quote>
145
+ <button
146
+ className="flex items-center gap-1.5 rounded-md px-2.5 py-1 text-sm hover:bg-accent"
147
+ onClick={() => navigator.clipboard.writeText(window.getSelection()?.toString() ?? "")}
148
+ >
149
+ <CopyIcon className="size-3.5" />
150
+ Copy
151
+ </button>
152
+ </SelectionToolbarPrimitive.Root>
153
+ ```
154
+
155
+ ## Relationship to Components
156
+
157
+ There is no pre-built shadcn component for SelectionToolbar. See the [Quoting guide](/docs/guides/quoting) for the full workflow including composer quote display and dismiss.
158
+
159
+ ## API Reference
160
+
161
+ For full prop details on every part, see the [SelectionToolbarPrimitive API Reference](/docs/api-reference/primitives/selection-toolbar).
162
+
163
+ Related:
164
+ - [Quoting Guide](/docs/guides/quoting)
165
+ - [ComposerPrimitive API Reference](/docs/api-reference/primitives/composer)
@@ -0,0 +1,242 @@
1
+ ---
2
+ title: Suggestion
3
+ description: Suggested prompts that users can click to quickly send or populate the composer.
4
+ ---
5
+
6
+ import { SuggestionPrimitiveSample } from "@/components/docs/samples/suggestion-primitive";
7
+ import { SuggestionPrimitive as SuggestionPrimitiveDocs } from "@/generated/primitiveDocs";
8
+
9
+ The Suggestion primitive renders suggested prompts as clickable pills that send a message or populate the composer. Use it for welcome screen suggestions, follow-up prompts, or quick actions. You provide the layout and styling.
10
+
11
+ <Tabs items={["Preview", "Code"]}>
12
+ <Tab>
13
+ <SuggestionPrimitiveSample />
14
+ </Tab>
15
+ <Tab>
16
+ ```tsx
17
+ import {
18
+ ThreadPrimitive,
19
+ SuggestionPrimitive,
20
+ } from "@assistant-ui/react";
21
+
22
+ function SuggestionList() {
23
+ return (
24
+ <div className="grid grid-cols-2 gap-2">
25
+ <ThreadPrimitive.Suggestions>
26
+ {() => <SuggestionItem />}
27
+ </ThreadPrimitive.Suggestions>
28
+ </div>
29
+ );
30
+ }
31
+
32
+ function SuggestionItem() {
33
+ return (
34
+ <SuggestionPrimitive.Trigger
35
+ send
36
+ className="flex flex-col items-start gap-1 rounded-2xl border px-4 py-3 text-left text-sm hover:bg-muted"
37
+ >
38
+ <span className="font-medium">
39
+ <SuggestionPrimitive.Title />
40
+ </span>
41
+ <span className="text-muted-foreground">
42
+ <SuggestionPrimitive.Description />
43
+ </span>
44
+ </SuggestionPrimitive.Trigger>
45
+ );
46
+ }
47
+ ```
48
+ </Tab>
49
+ </Tabs>
50
+
51
+ ## Quick Start
52
+
53
+ A suggestion list using the iterator pattern:
54
+
55
+ ```tsx
56
+ import { ThreadPrimitive, SuggestionPrimitive } from "@assistant-ui/react";
57
+
58
+ <ThreadPrimitive.Suggestions>
59
+ {() => <MySuggestionItem />}
60
+ </ThreadPrimitive.Suggestions>
61
+
62
+ function MySuggestionItem() {
63
+ return (
64
+ <SuggestionPrimitive.Trigger className="rounded-lg border px-3 py-2 hover:bg-muted">
65
+ <SuggestionPrimitive.Title />
66
+ </SuggestionPrimitive.Trigger>
67
+ );
68
+ }
69
+ ```
70
+
71
+ `ThreadPrimitive.Suggestions` iterates over available suggestions and renders your component for each one. Inside the component, `SuggestionPrimitive` parts read from the suggestion context automatically.
72
+
73
+ <Callout type="info">
74
+ Runtime setup: primitives require runtime context. Wrap your UI in `AssistantRuntimeProvider` with a runtime (for example `useLocalRuntime(...)`). See [Pick a Runtime](/docs/runtimes/pick-a-runtime).
75
+ </Callout>
76
+
77
+ ## Core Concepts
78
+
79
+ ### Context-Based Rendering
80
+
81
+ SuggestionPrimitive parts read from a suggestion context. Use `ThreadPrimitive.Suggestions` to provide this context. It iterates over the thread's suggestions and renders your component for each one:
82
+
83
+ ```tsx
84
+ <ThreadPrimitive.Suggestions>
85
+ {() => <MySuggestion />}
86
+ </ThreadPrimitive.Suggestions>
87
+ ```
88
+
89
+ You can also use `ThreadPrimitive.SuggestionByIndex` to render a specific suggestion by index if you need more layout control.
90
+
91
+ ### Title and Description
92
+
93
+ Suggestions support two text parts for structured display:
94
+
95
+ - **`Title`**: the primary text (e.g., "Write a blog post")
96
+ - **`Description`**: secondary text — renders the `label` field from the suggestion config (e.g., `{ prompt: "...", label: "About React Server Components" }`)
97
+
98
+ Both render a `<span>` and accept `children` to override the value from state:
99
+
100
+ ```tsx
101
+ <SuggestionPrimitive.Title>Custom title</SuggestionPrimitive.Title>
102
+ ```
103
+
104
+ ### Send vs Populate
105
+
106
+ `Trigger`'s `send` prop controls what happens on click:
107
+
108
+ - **`send={true}`**: immediately sends the suggestion as a new message. When the thread is running, it falls back to populating the composer instead.
109
+ - **`send={false}`** (default): populates the composer text so the user can edit before sending
110
+
111
+ ```tsx
112
+ // Send immediately
113
+ <SuggestionPrimitive.Trigger send>
114
+ <SuggestionPrimitive.Title />
115
+ </SuggestionPrimitive.Trigger>
116
+
117
+ // Populate composer for editing
118
+ <SuggestionPrimitive.Trigger>
119
+ <SuggestionPrimitive.Title />
120
+ </SuggestionPrimitive.Trigger>
121
+ ```
122
+
123
+ ### clearComposer
124
+
125
+ When `send={false}`, the `clearComposer` prop controls whether the suggestion replaces or appends to existing composer text:
126
+
127
+ - **`clearComposer={true}`** (default): replaces the current composer text
128
+ - **`clearComposer={false}`**: appends the suggestion to the existing text
129
+
130
+ ### ThreadPrimitive.Suggestion (Legacy)
131
+
132
+ `ThreadPrimitive.Suggestion` is a self-contained button that takes a `prompt` prop directly. The newer pattern (`ThreadPrimitive.Suggestions` + `SuggestionPrimitive` parts) is preferred for structured suggestions with title and description:
133
+
134
+ ```tsx
135
+ // Legacy: still works, but limited
136
+ <ThreadPrimitive.Suggestion prompt="Write a blog post" />
137
+
138
+ // Preferred: structured with title/description
139
+ <ThreadPrimitive.Suggestions>
140
+ {() => <MySuggestionItem />}
141
+ </ThreadPrimitive.Suggestions>
142
+ ```
143
+
144
+ `ThreadPrimitive.Suggestion` also supports deprecated `autoSend` and `method` props for backwards compatibility. Prefer `send` and `clearComposer`.
145
+
146
+ ## Parts
147
+
148
+ ### Title
149
+
150
+ Renders the suggestion title. Renders a `<span>` element unless `asChild` is set.
151
+
152
+ ```tsx
153
+ <SuggestionPrimitive.Title />
154
+ ```
155
+
156
+ ### Description
157
+
158
+ Renders the secondary suggestion description text. Renders a `<span>` element unless `asChild` is set.
159
+
160
+ ```tsx
161
+ <SuggestionPrimitive.Description />
162
+ ```
163
+
164
+ ### Trigger
165
+
166
+ Clickable button that sends or populates the suggestion. Renders a `<button>` element unless `asChild` is set.
167
+
168
+ ```tsx
169
+ <SuggestionPrimitive.Trigger send className="rounded-lg border px-3 py-2 hover:bg-muted">
170
+ <SuggestionPrimitive.Title />
171
+ </SuggestionPrimitive.Trigger>
172
+ ```
173
+
174
+ <PrimitivesTypeTable type="SuggestionPrimitiveTriggerProps" parameters={SuggestionPrimitiveDocs.Trigger.props.filter(p => p.name !== "asChild")} />
175
+
176
+ ## Patterns
177
+
178
+ ### Welcome Screen Grid
179
+
180
+ ```tsx
181
+ function WelcomeSuggestions() {
182
+ return (
183
+ <AuiIf condition={(s) => s.thread.isEmpty}>
184
+ <div className="text-center">
185
+ <h2 className="text-lg font-semibold">How can I help you?</h2>
186
+ <div className="mt-4 grid grid-cols-2 gap-2">
187
+ <ThreadPrimitive.Suggestions>
188
+ {() => <SuggestionCard />}
189
+ </ThreadPrimitive.Suggestions>
190
+ </div>
191
+ </div>
192
+ </AuiIf>
193
+ );
194
+ }
195
+
196
+ function SuggestionCard() {
197
+ return (
198
+ <SuggestionPrimitive.Trigger
199
+ send
200
+ className="flex flex-col gap-1 rounded-2xl border px-4 py-3 text-left hover:bg-muted"
201
+ >
202
+ <span className="font-medium">
203
+ <SuggestionPrimitive.Title />
204
+ </span>
205
+ <span className="text-sm text-muted-foreground">
206
+ <SuggestionPrimitive.Description />
207
+ </span>
208
+ </SuggestionPrimitive.Trigger>
209
+ );
210
+ }
211
+ ```
212
+
213
+ ### Send-On-Click Suggestions
214
+
215
+ ```tsx
216
+ <SuggestionPrimitive.Trigger send className="rounded-full border px-4 py-2 hover:bg-muted">
217
+ <SuggestionPrimitive.Title />
218
+ </SuggestionPrimitive.Trigger>
219
+ ```
220
+
221
+ ### Populate-Only Suggestions
222
+
223
+ ```tsx
224
+ <SuggestionPrimitive.Trigger
225
+ send={false}
226
+ clearComposer={false}
227
+ className="rounded-lg border px-3 py-1.5 text-sm hover:bg-muted"
228
+ >
229
+ <SuggestionPrimitive.Title />
230
+ </SuggestionPrimitive.Trigger>
231
+ ```
232
+
233
+ ## Relationship to Components
234
+
235
+ The shadcn [Thread](/docs/ui/thread) component includes suggestions in its welcome screen using `ThreadPrimitive.Suggestions` with `SuggestionPrimitive` parts in a responsive grid. Start there for a prebuilt welcome experience.
236
+
237
+ ## API Reference
238
+
239
+ For full prop details on every part, see the [SuggestionPrimitive API Reference](/docs/api-reference/primitives/suggestion).
240
+
241
+ Related:
242
+ - [ThreadPrimitive API Reference](/docs/api-reference/primitives/thread)