@assistant-ui/mcp-docs-server 0.1.23 → 0.1.25

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 (137) hide show
  1. package/.docs/organized/code-examples/waterfall.md +5 -3
  2. package/.docs/organized/code-examples/with-a2a.md +676 -0
  3. package/.docs/organized/code-examples/with-ag-ui.md +7 -8
  4. package/.docs/organized/code-examples/with-ai-sdk-v6.md +28 -16
  5. package/.docs/organized/code-examples/with-artifacts.md +5 -5
  6. package/.docs/organized/code-examples/with-assistant-transport.md +3 -3
  7. package/.docs/organized/code-examples/with-chain-of-thought.md +34 -26
  8. package/.docs/organized/code-examples/with-cloud-standalone.md +10 -8
  9. package/.docs/organized/code-examples/with-cloud.md +5 -5
  10. package/.docs/organized/code-examples/with-custom-thread-list.md +7 -7
  11. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +8 -8
  12. package/.docs/organized/code-examples/with-expo.md +571 -539
  13. package/.docs/organized/code-examples/with-external-store.md +3 -4
  14. package/.docs/organized/code-examples/with-ffmpeg.md +5 -5
  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-langgraph.md +25 -23
  18. package/.docs/organized/code-examples/with-parent-id-grouping.md +4 -4
  19. package/.docs/organized/code-examples/with-react-hook-form.md +6 -9
  20. package/.docs/organized/code-examples/with-react-ink.md +265 -0
  21. package/.docs/organized/code-examples/with-react-router.md +10 -11
  22. package/.docs/organized/code-examples/with-store.md +29 -18
  23. package/.docs/organized/code-examples/with-tanstack.md +7 -7
  24. package/.docs/organized/code-examples/with-tap-runtime.md +6 -4
  25. package/.docs/raw/blog/2025-01-31-changelog/index.mdx +1 -1
  26. package/.docs/raw/blog/2026-03-launch-week/index.mdx +227 -0
  27. package/.docs/raw/docs/(docs)/architecture.mdx +1 -1
  28. package/.docs/raw/docs/(docs)/cli.mdx +14 -9
  29. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +8 -3
  30. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +5 -1
  31. package/.docs/raw/docs/(docs)/copilots/{make-assistant-readable.mdx → make-assistant-visible.mdx} +14 -5
  32. package/.docs/raw/docs/(docs)/copilots/model-context.mdx +11 -11
  33. package/.docs/raw/docs/(docs)/copilots/motivation.mdx +2 -2
  34. package/.docs/raw/docs/(docs)/devtools.mdx +3 -2
  35. package/.docs/raw/docs/(docs)/guides/attachments.mdx +9 -11
  36. package/.docs/raw/docs/(docs)/guides/branching.mdx +11 -6
  37. package/.docs/raw/docs/(docs)/guides/chain-of-thought.mdx +18 -16
  38. package/.docs/raw/docs/(docs)/guides/context-api.mdx +81 -43
  39. package/.docs/raw/docs/(docs)/guides/dictation.mdx +5 -5
  40. package/.docs/raw/docs/(docs)/guides/editing.mdx +16 -7
  41. package/.docs/raw/docs/(docs)/guides/latex.mdx +3 -0
  42. package/.docs/raw/docs/(docs)/guides/message-timing.mdx +2 -1
  43. package/.docs/raw/docs/(docs)/guides/multi-agent.mdx +173 -0
  44. package/.docs/raw/docs/(docs)/guides/quoting.mdx +55 -206
  45. package/.docs/raw/docs/(docs)/guides/speech.mdx +1 -4
  46. package/.docs/raw/docs/(docs)/guides/suggestions.mdx +9 -15
  47. package/.docs/raw/docs/(docs)/guides/tool-ui.mdx +17 -7
  48. package/.docs/raw/docs/(docs)/guides/tools.mdx +24 -9
  49. package/.docs/raw/docs/(docs)/index.mdx +3 -3
  50. package/.docs/raw/docs/(docs)/installation.mdx +69 -46
  51. package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx +20 -6
  52. package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +24 -4
  53. package/.docs/raw/docs/(reference)/api-reference/integrations/react-hook-form.mdx +1 -1
  54. package/.docs/raw/docs/(reference)/api-reference/integrations/vercel-ai-sdk.mdx +20 -19
  55. package/.docs/raw/docs/(reference)/api-reference/overview.mdx +28 -53
  56. package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +4 -4
  57. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +7 -1
  58. package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +20 -14
  59. package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +1 -1
  60. package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +99 -45
  61. package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +52 -40
  62. package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +343 -23
  63. package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +4 -6
  64. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +4 -2
  65. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +3 -5
  66. package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +169 -22
  67. package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +14 -4
  68. package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +15 -26
  69. package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +39 -21
  70. package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +33 -9
  71. package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +48 -21
  72. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +36 -7
  73. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +30 -10
  74. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +12 -10
  75. package/.docs/raw/docs/(reference)/migrations/deprecation-policy.mdx +1 -1
  76. package/.docs/raw/docs/(reference)/migrations/react-langgraph-v0-7.mdx +9 -4
  77. package/.docs/raw/docs/(reference)/migrations/v0-11.mdx +7 -5
  78. package/.docs/raw/docs/(reference)/migrations/v0-12.mdx +9 -7
  79. package/.docs/raw/docs/(reference)/migrations/v0-14.mdx +159 -0
  80. package/.docs/raw/docs/(reference)/react-compatibility.mdx +5 -134
  81. package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +89 -7
  82. package/.docs/raw/docs/cloud/ai-sdk.mdx +19 -5
  83. package/.docs/raw/docs/cloud/langgraph.mdx +13 -3
  84. package/.docs/raw/docs/ink/adapters.mdx +41 -0
  85. package/.docs/raw/docs/ink/custom-backend.mdx +203 -0
  86. package/.docs/raw/docs/ink/hooks.mdx +448 -0
  87. package/.docs/raw/docs/ink/index.mdx +239 -0
  88. package/.docs/raw/docs/ink/migration.mdx +140 -0
  89. package/.docs/raw/docs/ink/primitives.mdx +699 -0
  90. package/.docs/raw/docs/react-native/adapters.mdx +63 -87
  91. package/.docs/raw/docs/react-native/custom-backend.mdx +11 -14
  92. package/.docs/raw/docs/react-native/hooks.mdx +214 -232
  93. package/.docs/raw/docs/react-native/index.mdx +118 -159
  94. package/.docs/raw/docs/react-native/migration.mdx +144 -0
  95. package/.docs/raw/docs/react-native/primitives.mdx +431 -302
  96. package/.docs/raw/docs/runtimes/a2a/index.mdx +294 -0
  97. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +9 -9
  98. package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +14 -3
  99. package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +53 -0
  100. package/.docs/raw/docs/runtimes/assistant-transport.mdx +59 -25
  101. package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +13 -6
  102. package/.docs/raw/docs/runtimes/custom/external-store.mdx +138 -38
  103. package/.docs/raw/docs/runtimes/custom/local.mdx +184 -42
  104. package/.docs/raw/docs/runtimes/data-stream.mdx +92 -19
  105. package/.docs/raw/docs/runtimes/google-adk/index.mdx +624 -0
  106. package/.docs/raw/docs/runtimes/helicone.mdx +6 -6
  107. package/.docs/raw/docs/runtimes/langgraph/index.mdx +38 -27
  108. package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +1 -1
  109. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +15 -20
  110. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +7 -11
  111. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +8 -11
  112. package/.docs/raw/docs/runtimes/langserve.mdx +6 -7
  113. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +18 -3
  114. package/.docs/raw/docs/ui/context-display.mdx +147 -0
  115. package/.docs/raw/docs/ui/file.mdx +5 -4
  116. package/.docs/raw/docs/ui/image.mdx +5 -4
  117. package/.docs/raw/docs/ui/markdown.mdx +3 -1
  118. package/.docs/raw/docs/ui/model-selector.mdx +8 -8
  119. package/.docs/raw/docs/ui/part-grouping.mdx +7 -10
  120. package/.docs/raw/docs/ui/quote.mdx +210 -0
  121. package/.docs/raw/docs/ui/reasoning.mdx +12 -11
  122. package/.docs/raw/docs/ui/sources.mdx +88 -17
  123. package/.docs/raw/docs/ui/streamdown.mdx +16 -7
  124. package/.docs/raw/docs/ui/thread-list.mdx +11 -13
  125. package/.docs/raw/docs/ui/thread.mdx +28 -33
  126. package/.docs/raw/docs/ui/tool-fallback.mdx +5 -6
  127. package/.docs/raw/docs/ui/tool-group.mdx +9 -8
  128. package/.docs/raw/docs/utilities/heat-graph.mdx +236 -0
  129. package/.docs/raw/docs/utilities/tw-shimmer.mdx +211 -0
  130. package/package.json +4 -4
  131. package/.docs/raw/docs/(reference)/legacy/styled/assistant-modal.mdx +0 -77
  132. package/.docs/raw/docs/(reference)/legacy/styled/decomposition.mdx +0 -635
  133. package/.docs/raw/docs/(reference)/legacy/styled/markdown.mdx +0 -77
  134. package/.docs/raw/docs/(reference)/legacy/styled/scrollbar.mdx +0 -72
  135. package/.docs/raw/docs/(reference)/legacy/styled/thread-width.mdx +0 -22
  136. package/.docs/raw/docs/(reference)/legacy/styled/thread.mdx +0 -77
  137. /package/.docs/raw/docs/cloud/{overview.mdx → index.mdx} +0 -0
@@ -5,98 +5,193 @@ description: Composable React Native components for building chat UIs.
5
5
 
6
6
  Primitives are thin wrappers around React Native components (`View`, `TextInput`, `FlatList`, `Pressable`) that integrate with the assistant-ui runtime. They accept all standard React Native props and add runtime-aware behavior.
7
7
 
8
+ Primitives are accessed via namespace imports (e.g. `ThreadPrimitive.Root`, `ComposerPrimitive.Input`), matching the pattern used in `@assistant-ui/react`.
9
+
8
10
  Many primitives share their core logic with `@assistant-ui/react` via `@assistant-ui/core/react` — only the UI layer (View/Pressable/Text vs DOM elements) differs.
9
11
 
10
12
  ## Thread
11
13
 
12
- ### ThreadRoot
14
+ ```tsx
15
+ import { ThreadPrimitive } from "@assistant-ui/react-native";
16
+ ```
17
+
18
+ ### ThreadPrimitive.Root
13
19
 
14
20
  Container `View` for the thread area.
15
21
 
16
22
  ```tsx
17
- import { ThreadRoot } from "@assistant-ui/react-native";
18
-
19
- <ThreadRoot style={{ flex: 1 }}>
23
+ <ThreadPrimitive.Root style={{ flex: 1 }}>
20
24
  {children}
21
- </ThreadRoot>
25
+ </ThreadPrimitive.Root>
22
26
  ```
23
27
 
24
28
  | Prop | Type | Description |
25
29
  |------|------|-------------|
26
30
  | `...rest` | `ViewProps` | Standard React Native View props |
27
31
 
28
- ### ThreadMessages
32
+ ### ThreadPrimitive.Messages
29
33
 
30
- `FlatList`-based message list with automatic runtime integration. Each message is wrapped in a scoped context so that `useAuiState((s) => s.message)` works inside `renderMessage`.
34
+ `FlatList`-based message list with automatic runtime integration. Each message is wrapped in a scoped context so that `useAuiState((s) => s.message)` works inside the rendered component.
31
35
 
32
36
  ```tsx
33
- import { ThreadMessages } from "@assistant-ui/react-native";
37
+ <ThreadPrimitive.Messages>
38
+ {() => <MyMessage />}
39
+ </ThreadPrimitive.Messages>
40
+ ```
34
41
 
35
- <ThreadMessages
36
- renderMessage={({ message }) => <MessageBubble message={message} />}
37
- />
42
+ You can also provide role-specific components:
43
+
44
+ ```tsx
45
+ <ThreadPrimitive.Messages>
46
+ {({ message }) => {
47
+ if (message.role === "user") return <MyUserMessage />;
48
+ return <MyAssistantMessage />;
49
+ }}
50
+ </ThreadPrimitive.Messages>
38
51
  ```
39
52
 
40
53
  | Prop | Type | Description |
41
54
  |------|------|-------------|
42
- | `renderMessage` | `(info: { message: ThreadMessage; index: number }) => ReactElement` | Message renderer |
55
+ | `components` | `MessageComponents` | Component map provide either a `Message` component (used for all roles) or role-specific `UserMessage`, `AssistantMessage`, and optionally `SystemMessage`. Edit composers can be set via `EditComposer` or role-specific variants (`UserEditComposer`, `AssistantEditComposer`, `SystemEditComposer`). |
43
56
  | `...rest` | `FlatListProps` | Standard FlatList props (except `data`, `renderItem`) |
44
57
 
45
- ### ThreadEmpty
58
+ ### ThreadPrimitive.MessageByIndex
46
59
 
47
- Renders children only when the thread has no messages.
60
+ Renders a single message at a specific index in the thread. Provides message context so that `useAuiState((s) => s.message)` works inside the rendered component. This component is shared from `@assistant-ui/core/react`.
48
61
 
49
62
  ```tsx
50
- import { ThreadEmpty } from "@assistant-ui/react-native";
63
+ <ThreadPrimitive.MessageByIndex
64
+ index={0}
65
+ components={{
66
+ UserMessage: MyUserMessage,
67
+ AssistantMessage: MyAssistantMessage,
68
+ }}
69
+ />
70
+ ```
71
+
72
+ | Prop | Type | Description |
73
+ |------|------|-------------|
74
+ | `index` | `number` | Zero-based index of the message to render |
75
+ | `components` | `MessageComponents` | Same component map as `ThreadPrimitive.Messages` |
76
+
77
+ ### ThreadPrimitive.Empty
78
+
79
+ Renders its children only when the thread has no messages. Deprecated in favor of `AuiIf`.
51
80
 
52
- <ThreadEmpty>
81
+ ```tsx
82
+ <ThreadPrimitive.Empty>
53
83
  <Text>Send a message to get started</Text>
54
- </ThreadEmpty>
84
+ </ThreadPrimitive.Empty>
55
85
  ```
56
86
 
57
- ### ThreadIf
87
+ ### ThreadPrimitive.If
58
88
 
59
- Conditional rendering based on thread state.
89
+ Conditional rendering based on thread state. Deprecated in favor of `AuiIf`.
60
90
 
61
91
  ```tsx
62
- import { ThreadIf } from "@assistant-ui/react-native";
63
-
64
- <ThreadIf empty>
92
+ <ThreadPrimitive.If empty>
65
93
  <Text>No messages yet</Text>
66
- </ThreadIf>
94
+ </ThreadPrimitive.If>
67
95
 
68
- <ThreadIf running>
96
+ <ThreadPrimitive.If running>
69
97
  <ActivityIndicator />
70
- </ThreadIf>
98
+ </ThreadPrimitive.If>
71
99
  ```
72
100
 
73
101
  | Prop | Type | Description |
74
102
  |------|------|-------------|
75
- | `empty` | `boolean` | Render when thread is empty |
76
- | `running` | `boolean` | Render when thread is running |
103
+ | `empty` | `boolean` | Renders children when thread emptiness matches this value |
104
+ | `running` | `boolean` | Renders children when thread running state matches this value |
105
+
106
+ ### ThreadPrimitive.Suggestion
107
+
108
+ `Pressable` that inserts or sends a hard-coded suggestion prompt. Unlike `SuggestionPrimitive.Trigger`, this component does not require a suggestion context — the prompt is passed directly as a prop.
109
+
110
+ ```tsx
111
+ <ThreadPrimitive.Suggestion prompt="What can you help me with?" send>
112
+ <Text>What can you help me with?</Text>
113
+ </ThreadPrimitive.Suggestion>
114
+ ```
115
+
116
+ | Prop | Type | Description |
117
+ |------|------|-------------|
118
+ | `prompt` | `string` | The text to send or insert into the composer |
119
+ | `send` | `boolean` | When true, sends the prompt immediately; when false, inserts into composer (default: false) |
120
+ | `clearComposer` | `boolean` | Whether to replace composer text (default: true) |
121
+ | `...rest` | `PressableProps` | Standard Pressable props (except `onPress`) |
122
+
123
+ ### ThreadPrimitive.Suggestions
124
+
125
+ Renders all suggestions using the provided component configuration. This component is shared from `@assistant-ui/core/react`.
126
+
127
+ ```tsx
128
+ <ThreadPrimitive.Suggestions>
129
+ {() => <MySuggestion />}
130
+ </ThreadPrimitive.Suggestions>
131
+ ```
132
+
133
+ | Prop | Type | Description |
134
+ |------|------|-------------|
135
+ | `components` | `{ Suggestion: ComponentType }` | Component to render for each suggestion |
136
+
137
+ ### ThreadPrimitive.SuggestionByIndex
138
+
139
+ Renders a single suggestion at the specified index, providing suggestion context. This component is shared from `@assistant-ui/core/react`.
140
+
141
+ ```tsx
142
+ <ThreadPrimitive.SuggestionByIndex
143
+ index={0}
144
+ components={{ Suggestion: MySuggestion }}
145
+ />
146
+ ```
147
+
148
+ | Prop | Type | Description |
149
+ |------|------|-------------|
150
+ | `index` | `number` | Zero-based index of the suggestion to render |
151
+ | `components` | `{ Suggestion: ComponentType }` | Component to render for the suggestion |
152
+
153
+ ### AuiIf
154
+
155
+ Conditional rendering based on assistant state. Replaces the deprecated `ThreadPrimitive.Empty`, `ThreadPrimitive.If`, `MessagePrimitive.If`, and `ComposerPrimitive.If`.
156
+
157
+ ```tsx
158
+ import { AuiIf } from "@assistant-ui/react-native";
159
+
160
+ <AuiIf condition={(s) => s.thread.isEmpty}>
161
+ <Text>Send a message to get started</Text>
162
+ </AuiIf>
163
+
164
+ <AuiIf condition={(s) => s.thread.isRunning}>
165
+ <ActivityIndicator />
166
+ </AuiIf>
167
+ ```
168
+
169
+ | Prop | Type | Description |
170
+ |------|------|-------------|
171
+ | `condition` | `(state) => boolean` | Selector that determines whether children are rendered |
77
172
 
78
173
  ## Composer
79
174
 
80
- ### ComposerRoot
175
+ ```tsx
176
+ import { ComposerPrimitive } from "@assistant-ui/react-native";
177
+ ```
178
+
179
+ ### ComposerPrimitive.Root
81
180
 
82
181
  Container `View` for the composer area.
83
182
 
84
183
  ```tsx
85
- import { ComposerRoot } from "@assistant-ui/react-native";
86
-
87
- <ComposerRoot style={styles.composerContainer}>
184
+ <ComposerPrimitive.Root style={styles.composerContainer}>
88
185
  {children}
89
- </ComposerRoot>
186
+ </ComposerPrimitive.Root>
90
187
  ```
91
188
 
92
- ### ComposerInput
189
+ ### ComposerPrimitive.Input
93
190
 
94
191
  `TextInput` wired to the composer runtime. Value and `onChangeText` are managed automatically.
95
192
 
96
193
  ```tsx
97
- import { ComposerInput } from "@assistant-ui/react-native";
98
-
99
- <ComposerInput
194
+ <ComposerPrimitive.Input
100
195
  placeholder="Message..."
101
196
  multiline
102
197
  style={styles.input}
@@ -105,120 +200,260 @@ import { ComposerInput } from "@assistant-ui/react-native";
105
200
 
106
201
  | Prop | Type | Description |
107
202
  |------|------|-------------|
203
+ | `submitMode` | `"enter" \| "none"` | Whether Enter sends the message on web (default: `"enter"`) |
108
204
  | `...rest` | `TextInputProps` | Standard TextInput props (except `value`, `onChangeText`) |
109
205
 
110
- ### ComposerSend
206
+ ### ComposerPrimitive.Send
111
207
 
112
208
  `Pressable` that sends the current message. Automatically disabled when the composer is empty.
113
209
 
114
210
  ```tsx
115
- import { ComposerSend } from "@assistant-ui/react-native";
116
-
117
- <ComposerSend style={styles.sendButton}>
211
+ <ComposerPrimitive.Send style={styles.sendButton}>
118
212
  <Text>Send</Text>
119
- </ComposerSend>
213
+ </ComposerPrimitive.Send>
120
214
  ```
121
215
 
122
- ### ComposerCancel
216
+ ### ComposerPrimitive.Cancel
123
217
 
124
218
  `Pressable` that cancels the current run. Automatically disabled when no run is active.
125
219
 
126
220
  ```tsx
127
- import { ComposerCancel } from "@assistant-ui/react-native";
128
-
129
- <ComposerCancel style={styles.cancelButton}>
221
+ <ComposerPrimitive.Cancel style={styles.cancelButton}>
130
222
  <Text>Stop</Text>
131
- </ComposerCancel>
223
+ </ComposerPrimitive.Cancel>
132
224
  ```
133
225
 
134
- ### ComposerAttachments
226
+ ### ComposerPrimitive.Attachments
135
227
 
136
228
  Renders composer attachments using the provided component configuration.
137
229
 
138
230
  ```tsx
139
- import { ComposerAttachments } from "@assistant-ui/react-native";
231
+ <ComposerPrimitive.Attachments>
232
+ {({ attachment }) => {
233
+ if (attachment.type === "image") return <MyImageAttachment />;
234
+ if (attachment.type === "document") return <MyDocumentAttachment />;
235
+ return <MyFallbackAttachment />;
236
+ }}
237
+ </ComposerPrimitive.Attachments>
238
+ ```
239
+
240
+ | Prop | Type | Description |
241
+ |------|------|-------------|
242
+ | `components` | `{ Image?, Document?, File?, Attachment? }` | Component renderers by attachment type |
243
+
244
+ ### ComposerPrimitive.AddAttachment
245
+
246
+ `Pressable` for triggering attachment addition. The actual file picker must be implemented by the consumer (e.g. using `expo-document-picker` or `expo-image-picker`).
140
247
 
141
- <ComposerAttachments
248
+ ```tsx
249
+ <ComposerPrimitive.AddAttachment>
250
+ <Text>Attach</Text>
251
+ </ComposerPrimitive.AddAttachment>
252
+ ```
253
+
254
+ ### ComposerPrimitive.AttachmentByIndex
255
+
256
+ Renders a single composer attachment at the specified index. Useful for building custom attachment layouts.
257
+
258
+ ```tsx
259
+ <ComposerPrimitive.AttachmentByIndex
260
+ index={0}
142
261
  components={{
143
262
  Image: MyImageAttachment,
144
- Document: MyDocumentAttachment,
145
- Attachment: MyFallbackAttachment, // fallback for all types
263
+ Attachment: MyFallbackAttachment,
146
264
  }}
147
265
  />
148
266
  ```
149
267
 
150
268
  | Prop | Type | Description |
151
269
  |------|------|-------------|
270
+ | `index` | `number` | Zero-based index of the attachment to render |
152
271
  | `components` | `{ Image?, Document?, File?, Attachment? }` | Component renderers by attachment type |
153
272
 
273
+ ### ComposerPrimitive.EditInput
274
+
275
+ `TextInput` wired to the edit composer runtime. Used inside an edit composer to allow editing an existing message. Value and `onChangeText` are managed automatically.
276
+
277
+ ```tsx
278
+ <ComposerPrimitive.EditInput
279
+ placeholder="Edit message..."
280
+ multiline
281
+ style={styles.input}
282
+ />
283
+ ```
284
+
285
+ | Prop | Type | Description |
286
+ |------|------|-------------|
287
+ | `...rest` | `TextInputProps` | Standard TextInput props (except `value`, `onChangeText`) |
288
+
289
+ ### ComposerPrimitive.EditSend
290
+
291
+ `Pressable` that confirms and submits a message edit. Automatically disabled when the composer is empty.
292
+
293
+ ```tsx
294
+ <ComposerPrimitive.EditSend style={styles.sendButton}>
295
+ <Text>Save</Text>
296
+ </ComposerPrimitive.EditSend>
297
+ ```
298
+
299
+ ### ComposerPrimitive.EditCancel
300
+
301
+ `Pressable` that cancels an in-progress message edit and returns to the original message.
302
+
303
+ ```tsx
304
+ <ComposerPrimitive.EditCancel style={styles.cancelButton}>
305
+ <Text>Cancel</Text>
306
+ </ComposerPrimitive.EditCancel>
307
+ ```
308
+
309
+ ### Conditional Rendering (Composer)
310
+
311
+ Use `AuiIf` for conditional rendering based on composer state:
312
+
313
+ ```tsx
314
+ <AuiIf condition={(s) => s.composer.isEditing}>
315
+ <Text>Currently editing</Text>
316
+ </AuiIf>
317
+
318
+ <AuiIf condition={(s) => s.composer.dictation != null}>
319
+ <Text>Dictation active</Text>
320
+ </AuiIf>
321
+ ```
322
+
154
323
  ## Message
155
324
 
156
- ### MessageRoot
325
+ ```tsx
326
+ import { MessagePrimitive } from "@assistant-ui/react-native";
327
+ ```
328
+
329
+ ### MessagePrimitive.Root
157
330
 
158
331
  Container `View` for a single message.
159
332
 
160
333
  ```tsx
161
- import { MessageRoot } from "@assistant-ui/react-native";
162
-
163
- <MessageRoot style={styles.messageBubble}>
334
+ <MessagePrimitive.Root style={styles.messageBubble}>
164
335
  {children}
165
- </MessageRoot>
336
+ </MessagePrimitive.Root>
166
337
  ```
167
338
 
168
- ### MessageContent
339
+ ### MessagePrimitive.Content
169
340
 
170
- Renders message content parts. Tool call and data parts automatically render registered tool UIs (via `useAssistantTool` / `useAssistantDataUI`), falling back to render props if provided.
341
+ Renders message content parts using render-prop functions instead of the component-map approach used by `MessagePrimitive.Parts`. Each part type receives a `part` object and its `index`. Registered tool UIs (via `useAssistantTool`) are automatically dispatched and take priority over `renderToolCall`.
171
342
 
172
343
  ```tsx
173
- import { MessageContent } from "@assistant-ui/react-native";
174
-
175
- <MessageContent
344
+ <MessagePrimitive.Content
176
345
  renderText={({ part }) => <Text>{part.text}</Text>}
177
- renderImage={({ part }) => <Image source={{ uri: part.image }} />}
346
+ renderToolCall={({ part, index }) => (
347
+ <Text>Tool: {part.toolName}</Text>
348
+ )}
349
+ renderImage={({ part }) => (
350
+ <Image source={{ uri: part.image }} />
351
+ )}
178
352
  />
179
353
  ```
180
354
 
181
355
  | Prop | Type | Description |
182
356
  |------|------|-------------|
183
- | `renderText` | `(props: { part; index }) => ReactElement` | Text part renderer |
184
- | `renderToolCall` | `(props: { part; index }) => ReactElement` | Tool call fallback (used when no tool UI is registered) |
185
- | `renderImage` | `(props: { part; index }) => ReactElement` | Image part renderer |
186
- | `renderReasoning` | `(props: { part; index }) => ReactElement` | Reasoning part renderer |
187
- | `renderSource` | `(props: { part; index }) => ReactElement` | Source part renderer |
188
- | `renderFile` | `(props: { part; index }) => ReactElement` | File part renderer |
189
- | `renderData` | `(props: { part; index }) => ReactElement` | Data part fallback (used when no data UI is registered) |
357
+ | `renderText` | `(props: { part, index }) => ReactElement` | Renderer for text parts (default: React Native `<Text>`) |
358
+ | `renderToolCall` | `(props: { part, index }) => ReactElement` | Fallback renderer for tool-call parts not handled by registered tool UIs |
359
+ | `renderImage` | `(props: { part, index }) => ReactElement` | Renderer for image parts |
360
+ | `renderReasoning` | `(props: { part, index }) => ReactElement` | Renderer for reasoning parts |
361
+ | `renderSource` | `(props: { part, index }) => ReactElement` | Renderer for source parts |
362
+ | `renderFile` | `(props: { part, index }) => ReactElement` | Renderer for file parts |
363
+ | `renderData` | `(props: { part, index }) => ReactElement` | Fallback renderer for data parts not handled by registered data UIs |
190
364
 
191
- ### MessageIf
365
+ ### MessagePrimitive.Parts
192
366
 
193
- Conditional rendering based on message properties.
367
+ Renders message content parts via a `components` prop. Tool call and data parts automatically render registered tool UIs (via `useAssistantTool` / `useAssistantDataUI`), falling back to components provided here. A default `Text` component using React Native's `<Text>` is provided out of the box.
194
368
 
195
369
  ```tsx
196
- import { MessageIf } from "@assistant-ui/react-native";
370
+ <MessagePrimitive.Parts>
371
+ {({ part }) => {
372
+ if (part.type === "text") return <Text>{part.text}</Text>;
373
+ if (part.type === "image") return <Image source={{ uri: part.image }} />;
374
+ if (part.type === "tool-call") return <MyToolCallComponent {...part} />;
375
+ return null;
376
+ }}
377
+ </MessagePrimitive.Parts>
378
+ ```
197
379
 
198
- <MessageIf user>
199
- <Text>You said:</Text>
200
- </MessageIf>
380
+ | Prop | Type | Description |
381
+ |------|------|-------------|
382
+ | `components` | `object` | Component map for rendering each part type. See below. |
201
383
 
202
- <MessageIf assistant last>
203
- <ActivityIndicator />
204
- </MessageIf>
384
+ **`components` fields:**
385
+
386
+ | Field | Type | Description |
387
+ |-------|------|-------------|
388
+ | `Text` | `TextMessagePartComponent` | Text part renderer (default: React Native `<Text>`) |
389
+ | `Image` | `ImageMessagePartComponent` | Image part renderer |
390
+ | `Reasoning` | `ReasoningMessagePartComponent` | Reasoning part renderer |
391
+ | `Source` | `SourceMessagePartComponent` | Source part renderer |
392
+ | `File` | `FileMessagePartComponent` | File part renderer |
393
+ | `Unstable_Audio` | `AudioMessagePartComponent` | Audio part renderer (experimental) |
394
+ | `tools` | `{ by_name?, Fallback? }` or `{ Override }` | Tool call rendering config — use `by_name` to map tool names to components, `Fallback` for unregistered tools, or `Override` to handle all tool calls |
395
+ | `data` | `{ by_name?, Fallback? }` | Data part rendering config — use `by_name` to map data event names, `Fallback` for unmatched events |
396
+ | `Empty` | `EmptyMessagePartComponent` | Component shown for empty messages |
397
+ | `Quote` | `QuoteMessagePartComponent` | Component for rendering quoted message references |
398
+ | `ChainOfThought` | `ComponentType` | Groups all reasoning and tool-call parts into a single component (mutually exclusive with `Reasoning`/`tools`/`ToolGroup`/`ReasoningGroup`) |
399
+
400
+ ### MessagePrimitive.PartByIndex
401
+
402
+ Renders a single message part at the specified index, providing part context. Useful for building custom part layouts outside of `MessagePrimitive.Parts`. This component is shared from `@assistant-ui/core/react`.
403
+
404
+ ```tsx
405
+ <MessagePrimitive.PartByIndex
406
+ index={0}
407
+ components={{
408
+ Text: ({ text }) => <Text>{text}</Text>,
409
+ tools: { Fallback: MyToolComponent },
410
+ }}
411
+ />
205
412
  ```
206
413
 
207
414
  | Prop | Type | Description |
208
415
  |------|------|-------------|
209
- | `user` | `boolean` | Render for user messages |
210
- | `assistant` | `boolean` | Render for assistant messages |
211
- | `running` | `boolean` | Render when message is being generated |
212
- | `last` | `boolean` | Render for the last message |
416
+ | `index` | `number` | Zero-based index of the message part to render |
417
+ | `components` | `object` | Same component map as `MessagePrimitive.Parts` |
213
418
 
214
- ### MessageAttachments
419
+ ### Conditional Rendering (Message)
420
+
421
+ Use `AuiIf` for conditional rendering based on message properties:
422
+
423
+ ```tsx
424
+ <AuiIf condition={(s) => s.message.role === "user"}>
425
+ <Text>You said:</Text>
426
+ </AuiIf>
427
+
428
+ <AuiIf condition={(s) => s.message.role === "assistant" && s.message.isLast}>
429
+ <ActivityIndicator />
430
+ </AuiIf>
431
+ ```
432
+
433
+ ### MessagePrimitive.Attachments
215
434
 
216
435
  Renders user message attachments using the provided component configuration.
217
436
 
218
437
  ```tsx
219
- import { MessageAttachments } from "@assistant-ui/react-native";
438
+ <MessagePrimitive.Attachments>
439
+ {({ attachment }) => {
440
+ if (attachment.type === "image") return <MyImageAttachment />;
441
+ return <MyFallbackAttachment />;
442
+ }}
443
+ </MessagePrimitive.Attachments>
444
+ ```
445
+
446
+ | Prop | Type | Description |
447
+ |------|------|-------------|
448
+ | `components` | `{ Image?, Document?, File?, Attachment? }` | Component renderers by attachment type |
220
449
 
221
- <MessageAttachments
450
+ ### MessagePrimitive.AttachmentByIndex
451
+
452
+ Renders a single message attachment at the specified index. Useful for building custom attachment layouts outside of `MessagePrimitive.Attachments`.
453
+
454
+ ```tsx
455
+ <MessagePrimitive.AttachmentByIndex
456
+ index={0}
222
457
  components={{
223
458
  Image: MyImageAttachment,
224
459
  Attachment: MyFallbackAttachment,
@@ -228,68 +463,67 @@ import { MessageAttachments } from "@assistant-ui/react-native";
228
463
 
229
464
  | Prop | Type | Description |
230
465
  |------|------|-------------|
466
+ | `index` | `number` | Zero-based index of the attachment to render |
231
467
  | `components` | `{ Image?, Document?, File?, Attachment? }` | Component renderers by attachment type |
232
468
 
233
469
  ## Attachment
234
470
 
235
- Primitives for rendering individual attachments (inside `ComposerAttachments` or `MessageAttachments`).
471
+ ```tsx
472
+ import { AttachmentPrimitive } from "@assistant-ui/react-native";
473
+ ```
474
+
475
+ Primitives for rendering individual attachments (inside `ComposerPrimitive.Attachments` or `MessagePrimitive.Attachments`).
236
476
 
237
- ### AttachmentRoot
477
+ ### AttachmentPrimitive.Root
238
478
 
239
479
  Container `View` for an attachment.
240
480
 
241
481
  ```tsx
242
- import { AttachmentRoot } from "@assistant-ui/react-native";
243
-
244
- <AttachmentRoot style={styles.attachment}>
482
+ <AttachmentPrimitive.Root style={styles.attachment}>
245
483
  {children}
246
- </AttachmentRoot>
484
+ </AttachmentPrimitive.Root>
247
485
  ```
248
486
 
249
- ### AttachmentName
487
+ ### AttachmentPrimitive.Name
250
488
 
251
489
  `Text` component displaying the attachment filename.
252
490
 
253
491
  ```tsx
254
- import { AttachmentName } from "@assistant-ui/react-native";
255
-
256
- <AttachmentName style={styles.filename} />
492
+ <AttachmentPrimitive.Name style={styles.filename} />
257
493
  ```
258
494
 
259
- ### AttachmentThumb
495
+ ### AttachmentPrimitive.Thumb
260
496
 
261
497
  `Text` component displaying the file extension (e.g. `.pdf`).
262
498
 
263
499
  ```tsx
264
- import { AttachmentThumb } from "@assistant-ui/react-native";
265
-
266
- <AttachmentThumb style={styles.extension} />
500
+ <AttachmentPrimitive.Thumb style={styles.extension} />
267
501
  ```
268
502
 
269
- ### AttachmentRemove
503
+ ### AttachmentPrimitive.Remove
270
504
 
271
505
  `Pressable` that removes the attachment from the composer.
272
506
 
273
507
  ```tsx
274
- import { AttachmentRemove } from "@assistant-ui/react-native";
275
-
276
- <AttachmentRemove>
508
+ <AttachmentPrimitive.Remove>
277
509
  <Text>Remove</Text>
278
- </AttachmentRemove>
510
+ </AttachmentPrimitive.Remove>
279
511
  ```
280
512
 
281
513
  ## ActionBar
282
514
 
283
- ### ActionBarCopy
515
+ ```tsx
516
+ import { ActionBarPrimitive } from "@assistant-ui/react-native";
517
+ ```
518
+
519
+ ### ActionBarPrimitive.Copy
284
520
 
285
521
  `Pressable` that copies the message content. Supports function-as-children for copy state feedback.
286
522
 
287
523
  ```tsx
288
- import { ActionBarCopy } from "@assistant-ui/react-native";
289
-
290
- <ActionBarCopy copiedDuration={3000}>
524
+ <ActionBarPrimitive.Copy copiedDuration={3000}>
291
525
  {({ isCopied }) => <Text>{isCopied ? "Copied!" : "Copy"}</Text>}
292
- </ActionBarCopy>
526
+ </ActionBarPrimitive.Copy>
293
527
  ```
294
528
 
295
529
  | Prop | Type | Description |
@@ -297,102 +531,90 @@ import { ActionBarCopy } from "@assistant-ui/react-native";
297
531
  | `copiedDuration` | `number` | Duration in ms to show "copied" state (default: 3000) |
298
532
  | `copyToClipboard` | `(text: string) => void` | Custom clipboard function |
299
533
 
300
- ### ActionBarEdit
534
+ ### ActionBarPrimitive.Edit
301
535
 
302
536
  `Pressable` that enters edit mode for a message.
303
537
 
304
538
  ```tsx
305
- import { ActionBarEdit } from "@assistant-ui/react-native";
306
-
307
- <ActionBarEdit>
539
+ <ActionBarPrimitive.Edit>
308
540
  <Text>Edit</Text>
309
- </ActionBarEdit>
541
+ </ActionBarPrimitive.Edit>
310
542
  ```
311
543
 
312
- ### ActionBarReload
544
+ ### ActionBarPrimitive.Reload
313
545
 
314
546
  `Pressable` that regenerates an assistant message.
315
547
 
316
548
  ```tsx
317
- import { ActionBarReload } from "@assistant-ui/react-native";
318
-
319
- <ActionBarReload>
549
+ <ActionBarPrimitive.Reload>
320
550
  <Text>Retry</Text>
321
- </ActionBarReload>
551
+ </ActionBarPrimitive.Reload>
322
552
  ```
323
553
 
324
- ### ActionBarFeedbackPositive / ActionBarFeedbackNegative
554
+ ### ActionBarPrimitive.FeedbackPositive / ActionBarPrimitive.FeedbackNegative
325
555
 
326
556
  `Pressable` buttons for submitting message feedback.
327
557
 
328
558
  ```tsx
329
- import {
330
- ActionBarFeedbackPositive,
331
- ActionBarFeedbackNegative,
332
- } from "@assistant-ui/react-native";
333
-
334
- <ActionBarFeedbackPositive>
335
- {({ isSubmitted }) => <Text>{isSubmitted ? "👍" : "👍🏻"}</Text>}
336
- </ActionBarFeedbackPositive>
559
+ <ActionBarPrimitive.FeedbackPositive>
560
+ {({ isSubmitted }) => <Text>{isSubmitted ? "Liked" : "Like"}</Text>}
561
+ </ActionBarPrimitive.FeedbackPositive>
337
562
 
338
- <ActionBarFeedbackNegative>
339
- {({ isSubmitted }) => <Text>{isSubmitted ? "👎" : "👎🏻"}</Text>}
340
- </ActionBarFeedbackNegative>
563
+ <ActionBarPrimitive.FeedbackNegative>
564
+ {({ isSubmitted }) => <Text>{isSubmitted ? "Disliked" : "Dislike"}</Text>}
565
+ </ActionBarPrimitive.FeedbackNegative>
341
566
  ```
342
567
 
343
568
  ## BranchPicker
344
569
 
345
- ### BranchPickerPrevious / BranchPickerNext
570
+ ```tsx
571
+ import { BranchPickerPrimitive } from "@assistant-ui/react-native";
572
+ ```
573
+
574
+ ### BranchPickerPrimitive.Previous / BranchPickerPrimitive.Next
346
575
 
347
576
  `Pressable` buttons to navigate between message branches.
348
577
 
349
578
  ```tsx
350
- import {
351
- BranchPickerPrevious,
352
- BranchPickerNext,
353
- BranchPickerNumber,
354
- BranchPickerCount,
355
- } from "@assistant-ui/react-native";
356
-
357
579
  <View style={{ flexDirection: "row", alignItems: "center" }}>
358
- <BranchPickerPrevious>
359
- <Text>←</Text>
360
- </BranchPickerPrevious>
361
- <BranchPickerNumber />
580
+ <BranchPickerPrimitive.Previous>
581
+ <Text>-</Text>
582
+ </BranchPickerPrimitive.Previous>
583
+ <BranchPickerPrimitive.Number />
362
584
  <Text>/</Text>
363
- <BranchPickerCount />
364
- <BranchPickerNext>
365
- <Text>→</Text>
366
- </BranchPickerNext>
585
+ <BranchPickerPrimitive.Count />
586
+ <BranchPickerPrimitive.Next>
587
+ <Text>+</Text>
588
+ </BranchPickerPrimitive.Next>
367
589
  </View>
368
590
  ```
369
591
 
370
- ### BranchPickerNumber / BranchPickerCount
592
+ ### BranchPickerPrimitive.Number / BranchPickerPrimitive.Count
371
593
 
372
594
  `Text` components displaying the current branch number and total count.
373
595
 
374
596
  ## ThreadList
375
597
 
376
- ### ThreadListRoot
598
+ ```tsx
599
+ import { ThreadListPrimitive } from "@assistant-ui/react-native";
600
+ ```
601
+
602
+ ### ThreadListPrimitive.Root
377
603
 
378
604
  Container `View` for the thread list.
379
605
 
380
606
  ```tsx
381
- import { ThreadListRoot } from "@assistant-ui/react-native";
382
-
383
- <ThreadListRoot style={styles.threadList}>
607
+ <ThreadListPrimitive.Root style={styles.threadList}>
384
608
  {children}
385
- </ThreadListRoot>
609
+ </ThreadListPrimitive.Root>
386
610
  ```
387
611
 
388
- ### ThreadListItems
612
+ ### ThreadListPrimitive.Items
389
613
 
390
614
  `FlatList` of thread IDs with runtime integration.
391
615
 
392
616
  ```tsx
393
- import { ThreadListItems } from "@assistant-ui/react-native";
394
-
395
- <ThreadListItems
617
+ <ThreadListPrimitive.Items
396
618
  renderItem={({ threadId }) => (
397
619
  <ThreadListEntry threadId={threadId} />
398
620
  )}
@@ -404,125 +626,112 @@ import { ThreadListItems } from "@assistant-ui/react-native";
404
626
  | `renderItem` | `(props: { threadId: string; index: number }) => ReactElement` | Thread item renderer |
405
627
  | `...rest` | `FlatListProps` | Standard FlatList props (except `data`, `renderItem`) |
406
628
 
407
- ### ThreadListNew
629
+ ### ThreadListPrimitive.New
408
630
 
409
631
  `Pressable` that creates a new thread.
410
632
 
411
633
  ```tsx
412
- import { ThreadListNew } from "@assistant-ui/react-native";
413
-
414
- <ThreadListNew style={styles.newThreadButton}>
634
+ <ThreadListPrimitive.New style={styles.newThreadButton}>
415
635
  <Text>New Chat</Text>
416
- </ThreadListNew>
636
+ </ThreadListPrimitive.New>
417
637
  ```
418
638
 
419
639
  ## ThreadListItem
420
640
 
421
- Primitives for rendering individual thread list items. Use inside a `ThreadListItemByIndexProvider` or within `ThreadListPrimitiveItems` components.
641
+ ```tsx
642
+ import { ThreadListItemPrimitive } from "@assistant-ui/react-native";
643
+ ```
644
+
645
+ Primitives for rendering individual thread list items.
422
646
 
423
- ### ThreadListItemRoot
647
+ ### ThreadListItemPrimitive.Root
424
648
 
425
649
  Container `View` for a thread list item.
426
650
 
427
651
  ```tsx
428
- import { ThreadListItemRoot } from "@assistant-ui/react-native";
429
-
430
- <ThreadListItemRoot style={styles.threadItem}>
652
+ <ThreadListItemPrimitive.Root style={styles.threadItem}>
431
653
  {children}
432
- </ThreadListItemRoot>
654
+ </ThreadListItemPrimitive.Root>
433
655
  ```
434
656
 
435
- ### ThreadListItemTitle
657
+ ### ThreadListItemPrimitive.Title
436
658
 
437
659
  Renders the thread title text. Falls back to the provided fallback when title is empty. This component is shared from `@assistant-ui/core/react`.
438
660
 
439
661
  ```tsx
440
- import { ThreadListItemTitle } from "@assistant-ui/react-native";
441
-
442
- <ThreadListItemTitle fallback="New Chat" />
662
+ <ThreadListItemPrimitive.Title fallback="New Chat" />
443
663
  ```
444
664
 
445
665
  | Prop | Type | Description |
446
666
  |------|------|-------------|
447
667
  | `fallback` | `ReactNode` | Content to show when title is empty |
448
668
 
449
- ### ThreadListItemTrigger
669
+ ### ThreadListItemPrimitive.Trigger
450
670
 
451
671
  `Pressable` that switches to the thread.
452
672
 
453
673
  ```tsx
454
- import { ThreadListItemTrigger } from "@assistant-ui/react-native";
455
-
456
- <ThreadListItemTrigger>
457
- <ThreadListItemTitle fallback="New Chat" />
458
- </ThreadListItemTrigger>
674
+ <ThreadListItemPrimitive.Trigger>
675
+ <ThreadListItemPrimitive.Title fallback="New Chat" />
676
+ </ThreadListItemPrimitive.Trigger>
459
677
  ```
460
678
 
461
- ### ThreadListItemDelete
679
+ ### ThreadListItemPrimitive.Delete
462
680
 
463
681
  `Pressable` that deletes the thread.
464
682
 
465
683
  ```tsx
466
- import { ThreadListItemDelete } from "@assistant-ui/react-native";
467
-
468
- <ThreadListItemDelete>
684
+ <ThreadListItemPrimitive.Delete>
469
685
  <Text>Delete</Text>
470
- </ThreadListItemDelete>
686
+ </ThreadListItemPrimitive.Delete>
471
687
  ```
472
688
 
473
- ### ThreadListItemArchive / ThreadListItemUnarchive
689
+ ### ThreadListItemPrimitive.Archive / ThreadListItemPrimitive.Unarchive
474
690
 
475
691
  `Pressable` buttons that archive or unarchive the thread.
476
692
 
477
693
  ```tsx
478
- import {
479
- ThreadListItemArchive,
480
- ThreadListItemUnarchive,
481
- } from "@assistant-ui/react-native";
482
-
483
- <ThreadListItemArchive>
694
+ <ThreadListItemPrimitive.Archive>
484
695
  <Text>Archive</Text>
485
- </ThreadListItemArchive>
696
+ </ThreadListItemPrimitive.Archive>
486
697
 
487
- <ThreadListItemUnarchive>
698
+ <ThreadListItemPrimitive.Unarchive>
488
699
  <Text>Unarchive</Text>
489
- </ThreadListItemUnarchive>
700
+ </ThreadListItemPrimitive.Unarchive>
490
701
  ```
491
702
 
492
703
  ## Suggestion
493
704
 
705
+ ```tsx
706
+ import { SuggestionPrimitive } from "@assistant-ui/react-native";
707
+ ```
708
+
494
709
  Primitives for rendering suggestions. Use inside a `SuggestionByIndexProvider` (from `@assistant-ui/core/react`).
495
710
 
496
- ### SuggestionTitle
711
+ ### SuggestionPrimitive.Title
497
712
 
498
713
  `Text` component displaying the suggestion title.
499
714
 
500
715
  ```tsx
501
- import { SuggestionTitle } from "@assistant-ui/react-native";
502
-
503
- <SuggestionTitle style={styles.suggestionTitle} />
716
+ <SuggestionPrimitive.Title style={styles.suggestionTitle} />
504
717
  ```
505
718
 
506
- ### SuggestionDescription
719
+ ### SuggestionPrimitive.Description
507
720
 
508
721
  `Text` component displaying the suggestion description/label.
509
722
 
510
723
  ```tsx
511
- import { SuggestionDescription } from "@assistant-ui/react-native";
512
-
513
- <SuggestionDescription style={styles.suggestionDescription} />
724
+ <SuggestionPrimitive.Description style={styles.suggestionDescription} />
514
725
  ```
515
726
 
516
- ### SuggestionTrigger
727
+ ### SuggestionPrimitive.Trigger
517
728
 
518
729
  `Pressable` that triggers the suggestion action (send or insert into composer).
519
730
 
520
731
  ```tsx
521
- import { SuggestionTrigger } from "@assistant-ui/react-native";
522
-
523
- <SuggestionTrigger send>
524
- <SuggestionTitle />
525
- </SuggestionTrigger>
732
+ <SuggestionPrimitive.Trigger send>
733
+ <SuggestionPrimitive.Title />
734
+ </SuggestionPrimitive.Trigger>
526
735
  ```
527
736
 
528
737
  | Prop | Type | Description |
@@ -530,124 +739,44 @@ import { SuggestionTrigger } from "@assistant-ui/react-native";
530
739
  | `send` | `boolean` | When true, sends immediately; when false, inserts into composer |
531
740
  | `clearComposer` | `boolean` | Whether to clear/replace composer text (default: true) |
532
741
 
533
- ### ThreadSuggestion
534
-
535
- Inline `Pressable` that triggers a suggestion with a specified prompt. Use this when you want to hardcode suggestion text.
536
-
537
- ```tsx
538
- import { ThreadSuggestion } from "@assistant-ui/react-native";
539
-
540
- <ThreadSuggestion prompt="Tell me a joke" send>
541
- <Text>Tell me a joke</Text>
542
- </ThreadSuggestion>
543
- ```
544
-
545
- | Prop | Type | Description |
546
- |------|------|-------------|
547
- | `prompt` | `string` | The suggestion text |
548
- | `send` | `boolean` | When true, sends immediately |
549
- | `clearComposer` | `boolean` | Whether to clear/replace composer text (default: true) |
550
-
551
- ### ThreadPrimitiveSuggestions
552
-
553
- Renders all suggestions from the store. Shared from `@assistant-ui/core/react`.
742
+ ## ChainOfThought
554
743
 
555
744
  ```tsx
556
- import { ThreadPrimitiveSuggestions } from "@assistant-ui/react-native";
557
-
558
- <ThreadPrimitiveSuggestions
559
- components={{ Suggestion: MySuggestionComponent }}
560
- />
745
+ import { ChainOfThoughtPrimitive } from "@assistant-ui/react-native";
561
746
  ```
562
747
 
563
- ## ChainOfThought
564
-
565
748
  Primitives for rendering chain of thought content (grouped reasoning and tool-call parts).
566
749
 
567
- ### ChainOfThoughtRoot
750
+ ### ChainOfThoughtPrimitive.Root
568
751
 
569
752
  Container `View` for chain of thought content.
570
753
 
571
754
  ```tsx
572
- import { ChainOfThoughtRoot } from "@assistant-ui/react-native";
573
-
574
- <ChainOfThoughtRoot style={styles.chainOfThought}>
755
+ <ChainOfThoughtPrimitive.Root style={styles.chainOfThought}>
575
756
  {children}
576
- </ChainOfThoughtRoot>
757
+ </ChainOfThoughtPrimitive.Root>
577
758
  ```
578
759
 
579
- ### ChainOfThoughtAccordionTrigger
760
+ ### ChainOfThoughtPrimitive.AccordionTrigger
580
761
 
581
762
  `Pressable` that toggles the collapsed state of the chain of thought.
582
763
 
583
764
  ```tsx
584
- import { ChainOfThoughtAccordionTrigger } from "@assistant-ui/react-native";
585
-
586
- <ChainOfThoughtAccordionTrigger>
765
+ <ChainOfThoughtPrimitive.AccordionTrigger>
587
766
  <Text>Toggle reasoning</Text>
588
- </ChainOfThoughtAccordionTrigger>
767
+ </ChainOfThoughtPrimitive.AccordionTrigger>
589
768
  ```
590
769
 
591
- ### ChainOfThoughtPrimitiveParts
770
+ ### ChainOfThoughtPrimitive.Parts
592
771
 
593
772
  Renders the parts within a chain of thought. Shared from `@assistant-ui/core/react`.
594
773
 
595
774
  ```tsx
596
- import { ChainOfThoughtPrimitiveParts } from "@assistant-ui/react-native";
597
-
598
- <ChainOfThoughtPrimitiveParts
599
- components={{
600
- Reasoning: ({ text }) => <Text>{text}</Text>,
601
- tools: { Fallback: MyToolComponent },
775
+ <ChainOfThoughtPrimitive.Parts>
776
+ {({ part }) => {
777
+ if (part.type === "reasoning") return <Text>{part.text}</Text>;
778
+ if (part.type === "tool-call") return <MyToolComponent {...part} />;
779
+ return null;
602
780
  }}
603
- />
604
- ```
605
-
606
- ## Additional Composer Primitives
607
-
608
- ### ComposerAddAttachment
609
-
610
- `Pressable` for triggering attachment addition. The actual file picker must be implemented by the consumer (e.g. using `expo-document-picker` or `expo-image-picker`).
611
-
612
- ```tsx
613
- import { ComposerAddAttachment } from "@assistant-ui/react-native";
614
-
615
- <ComposerAddAttachment onPress={handlePickFile}>
616
- <Text>📎</Text>
617
- </ComposerAddAttachment>
618
- ```
619
-
620
- ### ComposerIf
621
-
622
- Conditional rendering based on composer state. Shared from `@assistant-ui/core/react`.
623
-
624
- ```tsx
625
- import { ComposerIf } from "@assistant-ui/react-native";
626
-
627
- <ComposerIf editing>
628
- <Text>Currently editing</Text>
629
- </ComposerIf>
630
- ```
631
-
632
- | Prop | Type | Description |
633
- |------|------|-------------|
634
- | `editing` | `boolean` | Render when composer is in editing mode |
635
- | `dictation` | `boolean` | Render when dictation is active |
636
-
637
- ## Shared Primitives from core/react
638
-
639
- The following primitives are shared with `@assistant-ui/react` via `@assistant-ui/core/react` and work identically on both platforms:
640
-
641
- - **`ThreadPrimitiveMessages`** / **`ThreadPrimitiveMessageByIndex`** — Component-composition pattern for rendering messages (alternative to the FlatList-based `ThreadMessages`)
642
- - **`MessagePrimitiveParts`** / **`MessagePrimitivePartByIndex`** — Renders message parts with grouping, ChainOfThought, and Empty support (alternative to the render-props-based `MessageContent`). Uses `<Text>` as default text renderer on RN.
643
- - **`ThreadPrimitiveSuggestions`** / **`ThreadPrimitiveSuggestionByIndex`** — Renders suggestions from the store
644
- - **`ThreadListPrimitiveItems`** / **`ThreadListPrimitiveItemByIndex`** — Component-composition pattern for thread list items (alternative to the FlatList-based `ThreadListItems`)
645
- - **`ChainOfThoughtPrimitiveParts`** — Renders chain of thought parts
646
-
647
- ```tsx
648
- import {
649
- ThreadPrimitiveMessages,
650
- MessagePrimitiveParts,
651
- ThreadPrimitiveSuggestions,
652
- } from "@assistant-ui/react-native";
781
+ </ChainOfThoughtPrimitive.Parts>
653
782
  ```