@neo4j-ndl/react 4.16.8 → 4.16.9
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/package.json +5 -2
- package/skills/ndl-react/SKILL.md +152 -0
- package/skills/ndl-react/components/accordion.md +386 -0
- package/skills/ndl-react/components/ai/code-preview.md +128 -0
- package/skills/ndl-react/components/ai/file-tag.md +90 -0
- package/skills/ndl-react/components/ai/image-tag.md +91 -0
- package/skills/ndl-react/components/ai/more-files.md +73 -0
- package/skills/ndl-react/components/ai/presence.md +54 -0
- package/skills/ndl-react/components/ai/preview.md +498 -0
- package/skills/ndl-react/components/ai/prompt.md +362 -0
- package/skills/ndl-react/components/ai/reasoning.md +95 -0
- package/skills/ndl-react/components/ai/response.md +1109 -0
- package/skills/ndl-react/components/ai/suggestion.md +84 -0
- package/skills/ndl-react/components/ai/thinking.md +43 -0
- package/skills/ndl-react/components/ai/tool-call.md +43 -0
- package/skills/ndl-react/components/ai/user-bubble.md +187 -0
- package/skills/ndl-react/components/avatar.md +169 -0
- package/skills/ndl-react/components/banner.md +225 -0
- package/skills/ndl-react/components/box.md +39 -0
- package/skills/ndl-react/components/breadcrumbs.md +245 -0
- package/skills/ndl-react/components/checkbox.md +269 -0
- package/skills/ndl-react/components/clean-icon-button.md +294 -0
- package/skills/ndl-react/components/clipboard-button.md +154 -0
- package/skills/ndl-react/components/code-block.md +276 -0
- package/skills/ndl-react/components/code.md +68 -0
- package/skills/ndl-react/components/color-picker.md +131 -0
- package/skills/ndl-react/components/conditional-wrap.md +46 -0
- package/skills/ndl-react/components/data-grid.md +3121 -0
- package/skills/ndl-react/components/date-picker.md +652 -0
- package/skills/ndl-react/components/dialog.md +485 -0
- package/skills/ndl-react/components/dismissible-tag.md +136 -0
- package/skills/ndl-react/components/divider.md +96 -0
- package/skills/ndl-react/components/drawer.md +543 -0
- package/skills/ndl-react/components/dropdown-button.md +161 -0
- package/skills/ndl-react/components/dropzone.md +371 -0
- package/skills/ndl-react/components/filled-button.md +26 -0
- package/skills/ndl-react/components/flex.md +82 -0
- package/skills/ndl-react/components/graph-label.md +167 -0
- package/skills/ndl-react/components/icon-button-array.md +187 -0
- package/skills/ndl-react/components/icon-button.md +193 -0
- package/skills/ndl-react/components/inline-edit.md +209 -0
- package/skills/ndl-react/components/kbd.md +63 -0
- package/skills/ndl-react/components/loading-bar.md +43 -0
- package/skills/ndl-react/components/loading-spinner.md +57 -0
- package/skills/ndl-react/components/logo.md +57 -0
- package/skills/ndl-react/components/menu.md +993 -0
- package/skills/ndl-react/components/modal.md +27 -0
- package/skills/ndl-react/components/next/tree-view.md +966 -0
- package/skills/ndl-react/components/outlined-button.md +26 -0
- package/skills/ndl-react/components/popover.md +283 -0
- package/skills/ndl-react/components/progress-bar.md +70 -0
- package/skills/ndl-react/components/radio.md +150 -0
- package/skills/ndl-react/components/read-only-tag.md +96 -0
- package/skills/ndl-react/components/segmented-control.md +200 -0
- package/skills/ndl-react/components/select-icon-button.md +183 -0
- package/skills/ndl-react/components/select.md +530 -0
- package/skills/ndl-react/components/selectable-tag.md +203 -0
- package/skills/ndl-react/components/side-navigation.md +652 -0
- package/skills/ndl-react/components/skeleton.md +274 -0
- package/skills/ndl-react/components/slider.md +308 -0
- package/skills/ndl-react/components/spotlight.md +796 -0
- package/skills/ndl-react/components/status-indicator.md +57 -0
- package/skills/ndl-react/components/status-label.md +132 -0
- package/skills/ndl-react/components/switch.md +167 -0
- package/skills/ndl-react/components/tabs.md +433 -0
- package/skills/ndl-react/components/tag.md +91 -0
- package/skills/ndl-react/components/text-area.md +178 -0
- package/skills/ndl-react/components/text-button.md +25 -0
- package/skills/ndl-react/components/text-input.md +475 -0
- package/skills/ndl-react/components/text-link.md +119 -0
- package/skills/ndl-react/components/time-picker.md +137 -0
- package/skills/ndl-react/components/timezone-picker.md +496 -0
- package/skills/ndl-react/components/tooltip.md +478 -0
- package/skills/ndl-react/components/tree-view.md +545 -0
- package/skills/ndl-react/components/typography.md +72 -0
- package/skills/ndl-react/components/wizard.md +152 -0
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
# Prompt
|
|
2
|
+
|
|
3
|
+
Import: `import { Prompt } from '@neo4j-ndl/react/ai'`
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### Prompt
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Required | Default | Description |
|
|
10
|
+
|------|------|----------|---------|-------------|
|
|
11
|
+
| `bottomContent` | `ReactNode` | | | Content to display below the textarea, on the leading side |
|
|
12
|
+
| `bottomTrailingContent` | `ReactNode` | | | Content to display below the textarea, on the trailing side next to the submit button |
|
|
13
|
+
| `disclaimer` | `ReactNode` | | `All information should be verified.` | Disclaimer to display below the component |
|
|
14
|
+
| `headerContent` | `ReactNode` | | | Content to display above the input card, e.g. a status message while a prompt is running |
|
|
15
|
+
| `isDisabled` | `boolean` | | `false` | Whether the textarea is disabled |
|
|
16
|
+
| `isRunningPrompt` | `boolean` | | `false` | Whether the submit button is "running". Shows a stop icon when true. |
|
|
17
|
+
| `isSubmitDisabled` | `boolean` | | `false` | Whether the submit button is disabled |
|
|
18
|
+
| `maxRows` | `number` | | `5` | Maximum number of rows the textarea can expand to |
|
|
19
|
+
| `onCancelPrompt` | `((e: MouseEvent<HTMLButtonElement, MouseEvent>) => void)` | | | Callback function called when the cancel button is clicked |
|
|
20
|
+
| `onChange` | `((e: ChangeEvent<HTMLTextAreaElement, Element>) => void)` | | | Callback function called when the prompt text changes |
|
|
21
|
+
| `onSubmitPrompt` | `((e: KeyboardEvent<HTMLTextAreaElement> \| MouseEvent<HTMLButtonElement, MouseEvent>) => void)` | | | Callback function called when the submit button is clicked |
|
|
22
|
+
| `ref` | `Ref<HTMLDivElement>` | | | A ref to apply to the root element. |
|
|
23
|
+
| `textareaProps` | `HtmlAttributes<"textarea">` | | | Props for the textarea element |
|
|
24
|
+
| `topContent` | `ReactNode` | | | Content to display above the textarea |
|
|
25
|
+
| `value` | `string \| number \| readonly string[]` | | | The prompt text |
|
|
26
|
+
|
|
27
|
+
### Prompt.ContextTag
|
|
28
|
+
|
|
29
|
+
| Prop | Type | Required | Default | Description |
|
|
30
|
+
|------|------|----------|---------|-------------|
|
|
31
|
+
| `children` | `string` | | | |
|
|
32
|
+
| `onClose` | `() => void` | ✅ | | |
|
|
33
|
+
|
|
34
|
+
### Prompt.Select
|
|
35
|
+
|
|
36
|
+
| Prop | Type | Required | Default | Description |
|
|
37
|
+
|------|------|----------|---------|-------------|
|
|
38
|
+
| `onChange` | `(option: { label: ReactNode; value: string; }) => void` | ✅ | | |
|
|
39
|
+
| `options` | `{ label: ReactNode; value: string; }[]` | | `[]` | |
|
|
40
|
+
| `value` | `{ label: ReactNode; value: string; }` | ✅ | | |
|
|
41
|
+
|
|
42
|
+
## Examples
|
|
43
|
+
|
|
44
|
+
### Default
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
48
|
+
|
|
49
|
+
import { CleanIconButton } from '@neo4j-ndl/react';
|
|
50
|
+
import { Prompt } from '@neo4j-ndl/react/ai';
|
|
51
|
+
import { PlusIconOutline } from '@neo4j-ndl/react/icons';
|
|
52
|
+
import { useState } from 'react';
|
|
53
|
+
|
|
54
|
+
const Component = () => {
|
|
55
|
+
const [prompt, setPrompt] = useState('');
|
|
56
|
+
const [isRunningPrompt, setIsRunningPrompt] = useState(false);
|
|
57
|
+
|
|
58
|
+
const handleSubmitPrompt = () => {
|
|
59
|
+
setIsRunningPrompt(true);
|
|
60
|
+
alert(`You submitted the following prompt: ${prompt}`);
|
|
61
|
+
setPrompt('');
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<Prompt
|
|
66
|
+
isRunningPrompt={isRunningPrompt}
|
|
67
|
+
value={prompt}
|
|
68
|
+
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) =>
|
|
69
|
+
setPrompt(e.target.value)
|
|
70
|
+
}
|
|
71
|
+
onSubmitPrompt={handleSubmitPrompt}
|
|
72
|
+
onCancelPrompt={() => setIsRunningPrompt(false)}
|
|
73
|
+
bottomContent={
|
|
74
|
+
<CleanIconButton description="Add files" size="small">
|
|
75
|
+
<PlusIconOutline />
|
|
76
|
+
</CleanIconButton>
|
|
77
|
+
}
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export default Component;
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Advanced
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
89
|
+
|
|
90
|
+
import { CleanIconButton } from '@neo4j-ndl/react';
|
|
91
|
+
import { FileTag, ImageTag, Prompt } from '@neo4j-ndl/react/ai';
|
|
92
|
+
import { DocumentIconOutline, PlusIconOutline } from '@neo4j-ndl/react/icons';
|
|
93
|
+
import { useState } from 'react';
|
|
94
|
+
|
|
95
|
+
const Component = () => {
|
|
96
|
+
const [isRunningPrompt, setIsRunningPrompt] = useState(false);
|
|
97
|
+
const options: Array<{ label: React.ReactNode; value: string }> = [
|
|
98
|
+
{ label: 'Neo4j AI', value: 'neo4j' },
|
|
99
|
+
{ label: 'Special Agent', value: 'special-agent' },
|
|
100
|
+
{ label: 'Another Agent', value: 'another-agent' },
|
|
101
|
+
];
|
|
102
|
+
const [selectedOption, setSelectedOption] = useState(options[0]);
|
|
103
|
+
const [prompt, setPrompt] = useState('');
|
|
104
|
+
|
|
105
|
+
const handleSubmitPrompt = () => {
|
|
106
|
+
setIsRunningPrompt(true);
|
|
107
|
+
alert(`You submitted the following prompt: ${prompt}`);
|
|
108
|
+
setPrompt('');
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<Prompt
|
|
113
|
+
isRunningPrompt={isRunningPrompt}
|
|
114
|
+
value={prompt}
|
|
115
|
+
onChange={(e) => setPrompt(e.target.value)}
|
|
116
|
+
onSubmitPrompt={handleSubmitPrompt}
|
|
117
|
+
onCancelPrompt={() => setIsRunningPrompt(false)}
|
|
118
|
+
topContent={
|
|
119
|
+
<>
|
|
120
|
+
<FileTag
|
|
121
|
+
isLoading={true}
|
|
122
|
+
icon={<DocumentIconOutline />}
|
|
123
|
+
fileName="Science Fiction Bestsellers"
|
|
124
|
+
fileType="pdf"
|
|
125
|
+
isRemovable={true}
|
|
126
|
+
onClick={() => {
|
|
127
|
+
console.info('remove file');
|
|
128
|
+
}}
|
|
129
|
+
/>
|
|
130
|
+
<ImageTag
|
|
131
|
+
isLoading={true}
|
|
132
|
+
src="https://plus.unsplash.com/premium_photo-1676496046182-356a6a0ed002?q=80&w=2952&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"
|
|
133
|
+
alt="Landscape image"
|
|
134
|
+
fileName="Landscape image"
|
|
135
|
+
fileType="jpg"
|
|
136
|
+
isRemovable={true}
|
|
137
|
+
onClick={() => {
|
|
138
|
+
console.info('remove image');
|
|
139
|
+
}}
|
|
140
|
+
/>
|
|
141
|
+
<FileTag
|
|
142
|
+
icon={<DocumentIconOutline />}
|
|
143
|
+
fileName="Science Fiction Bestsellers"
|
|
144
|
+
fileType="pdf"
|
|
145
|
+
isRemovable={true}
|
|
146
|
+
onClick={() => {
|
|
147
|
+
console.info('remove file');
|
|
148
|
+
}}
|
|
149
|
+
/>
|
|
150
|
+
<ImageTag
|
|
151
|
+
src="https://plus.unsplash.com/premium_photo-1676496046182-356a6a0ed002?q=80&w=2952&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"
|
|
152
|
+
alt="Landscape image"
|
|
153
|
+
fileName="Landscape image"
|
|
154
|
+
fileType="jpg"
|
|
155
|
+
isRemovable={true}
|
|
156
|
+
onClick={() => {
|
|
157
|
+
console.info('remove image');
|
|
158
|
+
}}
|
|
159
|
+
/>
|
|
160
|
+
</>
|
|
161
|
+
}
|
|
162
|
+
bottomContent={
|
|
163
|
+
<>
|
|
164
|
+
<CleanIconButton description="Add stuff" size="small">
|
|
165
|
+
<PlusIconOutline />
|
|
166
|
+
</CleanIconButton>
|
|
167
|
+
</>
|
|
168
|
+
}
|
|
169
|
+
bottomTrailingContent={
|
|
170
|
+
<Prompt.Select
|
|
171
|
+
value={selectedOption}
|
|
172
|
+
options={options}
|
|
173
|
+
onChange={setSelectedOption}
|
|
174
|
+
/>
|
|
175
|
+
}
|
|
176
|
+
/>
|
|
177
|
+
);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export default Component;
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Context
|
|
184
|
+
|
|
185
|
+
```tsx
|
|
186
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
187
|
+
|
|
188
|
+
import { CleanIconButton } from '@neo4j-ndl/react';
|
|
189
|
+
import { Prompt } from '@neo4j-ndl/react/ai';
|
|
190
|
+
import { PlusIconOutline } from '@neo4j-ndl/react/icons';
|
|
191
|
+
import { useState } from 'react';
|
|
192
|
+
|
|
193
|
+
const Component = () => {
|
|
194
|
+
const [prompt, setPrompt] = useState('');
|
|
195
|
+
const [isRunningPrompt, setIsRunningPrompt] = useState(false);
|
|
196
|
+
|
|
197
|
+
const handleSubmitPrompt = () => {
|
|
198
|
+
setIsRunningPrompt(true);
|
|
199
|
+
alert(`You submitted the following prompt: ${prompt}`);
|
|
200
|
+
setPrompt('');
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
return (
|
|
204
|
+
<Prompt
|
|
205
|
+
isRunningPrompt={isRunningPrompt}
|
|
206
|
+
value={prompt}
|
|
207
|
+
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) =>
|
|
208
|
+
setPrompt(e.target.value)
|
|
209
|
+
}
|
|
210
|
+
onSubmitPrompt={handleSubmitPrompt}
|
|
211
|
+
onCancelPrompt={() => setIsRunningPrompt(false)}
|
|
212
|
+
topContent={
|
|
213
|
+
<>
|
|
214
|
+
<Prompt.ContextTag
|
|
215
|
+
onClose={() => {
|
|
216
|
+
alert('remove node label context');
|
|
217
|
+
}}
|
|
218
|
+
>
|
|
219
|
+
Node label
|
|
220
|
+
</Prompt.ContextTag>
|
|
221
|
+
<Prompt.ContextTag
|
|
222
|
+
onClose={() => {
|
|
223
|
+
alert('remove cypher query context');
|
|
224
|
+
}}
|
|
225
|
+
>
|
|
226
|
+
Cypher query
|
|
227
|
+
</Prompt.ContextTag>
|
|
228
|
+
<Prompt.ContextTag
|
|
229
|
+
onClose={() => {
|
|
230
|
+
alert('remove long context');
|
|
231
|
+
}}
|
|
232
|
+
>
|
|
233
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do
|
|
234
|
+
eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
235
|
+
</Prompt.ContextTag>
|
|
236
|
+
</>
|
|
237
|
+
}
|
|
238
|
+
bottomContent={
|
|
239
|
+
<CleanIconButton description="Add files" size="small">
|
|
240
|
+
<PlusIconOutline />
|
|
241
|
+
</CleanIconButton>
|
|
242
|
+
}
|
|
243
|
+
/>
|
|
244
|
+
);
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
export default Component;
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Disabled
|
|
251
|
+
|
|
252
|
+
```tsx
|
|
253
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
254
|
+
|
|
255
|
+
import { CleanIconButton } from '@neo4j-ndl/react';
|
|
256
|
+
import { Prompt } from '@neo4j-ndl/react/ai';
|
|
257
|
+
import { PlusIconOutline } from '@neo4j-ndl/react/icons';
|
|
258
|
+
import { useState } from 'react';
|
|
259
|
+
|
|
260
|
+
const Component = () => {
|
|
261
|
+
const [prompt, _setPrompt] = useState<string>('');
|
|
262
|
+
|
|
263
|
+
return (
|
|
264
|
+
<Prompt
|
|
265
|
+
value={prompt}
|
|
266
|
+
isDisabled={true}
|
|
267
|
+
isSubmitDisabled={true}
|
|
268
|
+
bottomContent={
|
|
269
|
+
<CleanIconButton description="Add files" size="small" isDisabled={true}>
|
|
270
|
+
<PlusIconOutline />
|
|
271
|
+
</CleanIconButton>
|
|
272
|
+
}
|
|
273
|
+
/>
|
|
274
|
+
);
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
export default Component;
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Header
|
|
281
|
+
|
|
282
|
+
```tsx
|
|
283
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
284
|
+
|
|
285
|
+
import { CleanIconButton, TextButton, Typography } from '@neo4j-ndl/react';
|
|
286
|
+
import { Prompt } from '@neo4j-ndl/react/ai';
|
|
287
|
+
import { PlusIconOutline } from '@neo4j-ndl/react/icons';
|
|
288
|
+
import { useState } from 'react';
|
|
289
|
+
|
|
290
|
+
const Component = () => {
|
|
291
|
+
const [prompt, setPrompt] = useState('');
|
|
292
|
+
const [isRunningPrompt, setIsRunningPrompt] = useState(false);
|
|
293
|
+
|
|
294
|
+
const handleSubmitPrompt = () => {
|
|
295
|
+
setIsRunningPrompt(true);
|
|
296
|
+
setPrompt('');
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
return (
|
|
300
|
+
<Prompt
|
|
301
|
+
isRunningPrompt={isRunningPrompt}
|
|
302
|
+
value={prompt}
|
|
303
|
+
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) =>
|
|
304
|
+
setPrompt(e.target.value)
|
|
305
|
+
}
|
|
306
|
+
onSubmitPrompt={handleSubmitPrompt}
|
|
307
|
+
onCancelPrompt={() => setIsRunningPrompt(false)}
|
|
308
|
+
headerContent={
|
|
309
|
+
<>
|
|
310
|
+
<Typography variant="body-medium">
|
|
311
|
+
We would like your feedback
|
|
312
|
+
</Typography>
|
|
313
|
+
<TextButton
|
|
314
|
+
size="small"
|
|
315
|
+
style={{ marginLeft: 'auto' }}
|
|
316
|
+
onClick={() => alert('Thanks for the feedback!')}
|
|
317
|
+
>
|
|
318
|
+
Give feedback
|
|
319
|
+
</TextButton>
|
|
320
|
+
</>
|
|
321
|
+
}
|
|
322
|
+
bottomContent={
|
|
323
|
+
<CleanIconButton description="Add files" size="small">
|
|
324
|
+
<PlusIconOutline />
|
|
325
|
+
</CleanIconButton>
|
|
326
|
+
}
|
|
327
|
+
/>
|
|
328
|
+
);
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
export default Component;
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### Loading
|
|
335
|
+
|
|
336
|
+
```tsx
|
|
337
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
338
|
+
|
|
339
|
+
import { CleanIconButton } from '@neo4j-ndl/react';
|
|
340
|
+
import { Prompt } from '@neo4j-ndl/react/ai';
|
|
341
|
+
import { PlusIconOutline } from '@neo4j-ndl/react/icons';
|
|
342
|
+
import { useState } from 'react';
|
|
343
|
+
|
|
344
|
+
const Component = () => {
|
|
345
|
+
const [isRunningPrompt, setIsRunningPrompt] = useState(true);
|
|
346
|
+
|
|
347
|
+
return (
|
|
348
|
+
<Prompt
|
|
349
|
+
isRunningPrompt={isRunningPrompt}
|
|
350
|
+
onSubmitPrompt={() => setIsRunningPrompt(true)}
|
|
351
|
+
onCancelPrompt={() => setIsRunningPrompt(false)}
|
|
352
|
+
bottomContent={
|
|
353
|
+
<CleanIconButton description="Add files" size="small">
|
|
354
|
+
<PlusIconOutline />
|
|
355
|
+
</CleanIconButton>
|
|
356
|
+
}
|
|
357
|
+
/>
|
|
358
|
+
);
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
export default Component;
|
|
362
|
+
```
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Reasoning
|
|
2
|
+
|
|
3
|
+
Import: `import { Reasoning } from '@neo4j-ndl/react/ai'`
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### Reasoning
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Required | Default | Description |
|
|
10
|
+
|------|------|----------|---------|-------------|
|
|
11
|
+
| `children` | `ReactNode` | | | What should be displayed inside the reasoning component. |
|
|
12
|
+
| `currentAction` | `string` | | `Thinking` | The current action the AI is performing |
|
|
13
|
+
| `isThinking` | `boolean` | | `true` | Whether the AI is thinking |
|
|
14
|
+
| `ref` | `Ref<HTMLDivElement>` | | | A ref to apply to the root element. |
|
|
15
|
+
| `thinkingMs` | `number` | | `1000` | The duration of the thinking in milliseconds |
|
|
16
|
+
|
|
17
|
+
### Reasoning.Footer
|
|
18
|
+
|
|
19
|
+
| Prop | Type | Required | Default | Description |
|
|
20
|
+
|------|------|----------|---------|-------------|
|
|
21
|
+
| `children` | `ReactNode` | ✅ | | |
|
|
22
|
+
| `ref` | `Ref<HTMLDivElement>` | | | A ref to apply to the root element. |
|
|
23
|
+
|
|
24
|
+
### Reasoning.Section
|
|
25
|
+
|
|
26
|
+
| Prop | Type | Required | Default | Description |
|
|
27
|
+
|------|------|----------|---------|-------------|
|
|
28
|
+
| `children` | `ReactNode` | | | The children of the section |
|
|
29
|
+
| `heading` | `ReactNode` | | | The heading of the section |
|
|
30
|
+
| `isDefaultExpanded` | `boolean` | | | The default value of the section is expanded. @deprecated - Does nothing, will be removed in v5 |
|
|
31
|
+
| `isExpanded` | `boolean` | | | Whether the section is expanded. @deprecated - Does nothing, will be removed in v5 |
|
|
32
|
+
| `leadingVisual` | `ReactNode` | | | The visual leading the section |
|
|
33
|
+
| `onExpandChange` | `(isExpanded: boolean) => void` | | | Callback function triggered when the section is expanded. @deprecated - Does nothing, will be removed in v5 |
|
|
34
|
+
| `ref` | `Ref<HTMLDivElement>` | | | A ref to apply to the root element. |
|
|
35
|
+
|
|
36
|
+
## Examples
|
|
37
|
+
|
|
38
|
+
### Full
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
42
|
+
|
|
43
|
+
import { FilledButton, Tooltip } from '@neo4j-ndl/react';
|
|
44
|
+
import { Reasoning } from '@neo4j-ndl/react/ai';
|
|
45
|
+
import {
|
|
46
|
+
InformationCircleIconOutline,
|
|
47
|
+
PencilSquareIconOutline,
|
|
48
|
+
WrenchIconOutline,
|
|
49
|
+
} from '@neo4j-ndl/react/icons';
|
|
50
|
+
import { useState } from 'react';
|
|
51
|
+
|
|
52
|
+
const Component = () => {
|
|
53
|
+
const [isThinking, setThinking] = useState(true);
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<div className="n-flex n-flex-col n-gap-token-12">
|
|
57
|
+
<FilledButton onClick={() => setThinking(!isThinking)}>
|
|
58
|
+
{isThinking ? 'Stop Thinking' : 'Start Thinking'}
|
|
59
|
+
</FilledButton>
|
|
60
|
+
<Reasoning
|
|
61
|
+
isThinking={isThinking}
|
|
62
|
+
thinkingMs={1400}
|
|
63
|
+
currentAction="Creating an action plan"
|
|
64
|
+
>
|
|
65
|
+
<Reasoning.Section
|
|
66
|
+
leadingVisual={<PencilSquareIconOutline />}
|
|
67
|
+
heading="Creating an action plan"
|
|
68
|
+
isDefaultExpanded={true}
|
|
69
|
+
>
|
|
70
|
+
Step 1 content
|
|
71
|
+
</Reasoning.Section>
|
|
72
|
+
<Reasoning.Section
|
|
73
|
+
leadingVisual={<WrenchIconOutline />}
|
|
74
|
+
heading="Applying agent tools"
|
|
75
|
+
>
|
|
76
|
+
Step 2 content
|
|
77
|
+
</Reasoning.Section>
|
|
78
|
+
<Reasoning.Footer>
|
|
79
|
+
Footer information
|
|
80
|
+
<Tooltip type="simple">
|
|
81
|
+
<Tooltip.Trigger
|
|
82
|
+
htmlAttributes={{ 'aria-label': 'Info about things like tokens' }}
|
|
83
|
+
>
|
|
84
|
+
<InformationCircleIconOutline className="n-size-token-16" />
|
|
85
|
+
</Tooltip.Trigger>
|
|
86
|
+
<Tooltip.Content>Info about things like tokens</Tooltip.Content>
|
|
87
|
+
</Tooltip>
|
|
88
|
+
</Reasoning.Footer>
|
|
89
|
+
</Reasoning>
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export default Component;
|
|
95
|
+
```
|