@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,530 @@
|
|
|
1
|
+
# Select
|
|
2
|
+
|
|
3
|
+
Import: `import { Select } from '@neo4j-ndl/react'`
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### Select
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Required | Default | Description |
|
|
10
|
+
|------|------|----------|---------|-------------|
|
|
11
|
+
| `ariaLabel` | `string` | | | Aria label of the select component |
|
|
12
|
+
| `as` | `ElementType<any, keyof IntrinsicElements>` | | | An override of the default HTML tag of the root of the component. Can also be another React component. |
|
|
13
|
+
| `errorText` | `ReactNode` | | | Error message, if it exists the select will be in error state |
|
|
14
|
+
| `helpText` | `ReactNode` | | | Help text of the select component |
|
|
15
|
+
| `isClean` | `boolean` | | `false` | Whether the select component is clean. If true, the select component will have a transparent background, no border and be hug the width of the content. |
|
|
16
|
+
| `isDisabled` | `boolean` | | | Whether the select component is disabled |
|
|
17
|
+
| `isFluid` | `boolean` | | `true` | Whether the select component is fluid |
|
|
18
|
+
| `label` | `ReactNode` | | | Label of the select component. If not provided, please provide an ariaLabel. |
|
|
19
|
+
| `ref` | `any` | | | A ref to apply to the root element. |
|
|
20
|
+
| `selectProps` | `StateManagerProps<OptionType, IsMulti, GroupType> \| CreatableProps<OptionType, IsMulti, GroupType> \| AsyncProps<...>` | | `{}` | Props of the select component, based of React Select props |
|
|
21
|
+
| `size` | `'large' \| 'medium' \| 'small'` | | `medium` | Size of the component |
|
|
22
|
+
| `type` | `'async' \| 'creatable' \| 'select'` | | `select` | Type of the select component |
|
|
23
|
+
|
|
24
|
+
The `type` prop is used to specify the type of select component to render, which will be passed to the underlying React Select component.
|
|
25
|
+
|
|
26
|
+
The `selectProps` prop is dynamically typed based on the `type` prop and can be one of the following: `StateManagerProps`, `CreatableProps`, `AsyncProps`. All select variants will have the `SelectProps` base type from React Select. For more information on the available props, see the [React Select documentation](https://react-select.com/props).
|
|
27
|
+
|
|
28
|
+
## Examples
|
|
29
|
+
|
|
30
|
+
### Default
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
34
|
+
|
|
35
|
+
import { Select } from '@neo4j-ndl/react';
|
|
36
|
+
|
|
37
|
+
const EXAMPLE_OPTIONS = [
|
|
38
|
+
{ label: 'Neo4j', value: 'neo4j' },
|
|
39
|
+
{ label: 'Needle 🪡', value: 'needle' },
|
|
40
|
+
{ label: 'Graph Databases', value: 'graph-database' },
|
|
41
|
+
{
|
|
42
|
+
label: 'Really long label that does not fit on one row',
|
|
43
|
+
value: 'long-label',
|
|
44
|
+
},
|
|
45
|
+
{ isDisabled: true, label: 'Disabled database option', value: 'disabled' },
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
const Component = (props: React.ComponentProps<typeof Select>) => {
|
|
49
|
+
return (
|
|
50
|
+
<Select
|
|
51
|
+
label="Select an option"
|
|
52
|
+
helpText="Help text"
|
|
53
|
+
type="select"
|
|
54
|
+
selectProps={{
|
|
55
|
+
menuIsOpen: props.selectProps?.menuIsOpen,
|
|
56
|
+
options: EXAMPLE_OPTIONS,
|
|
57
|
+
}}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default Component;
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Async
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
69
|
+
|
|
70
|
+
import { Select } from '@neo4j-ndl/react';
|
|
71
|
+
|
|
72
|
+
const EXAMPLE_OPTIONS = [
|
|
73
|
+
{ label: 'Neo4j', value: 'neo4j' },
|
|
74
|
+
{ label: 'Needle 🪡', value: 'needle' },
|
|
75
|
+
{ label: 'Graph Databases', value: 'graph-database' },
|
|
76
|
+
{ isDisabled: true, label: 'Disabled database option', value: 'disabled' },
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
const loadOptions = (inputValue: string) => {
|
|
80
|
+
return new Promise<typeof EXAMPLE_OPTIONS>((resolve) => {
|
|
81
|
+
setTimeout(() => {
|
|
82
|
+
const filteredOptions = EXAMPLE_OPTIONS.filter((option) =>
|
|
83
|
+
option.label.toLowerCase().includes(inputValue.toLowerCase()),
|
|
84
|
+
);
|
|
85
|
+
resolve(filteredOptions);
|
|
86
|
+
}, 1000);
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const Component = (props: React.ComponentProps<typeof Select>) => {
|
|
91
|
+
return (
|
|
92
|
+
<Select
|
|
93
|
+
label="Label"
|
|
94
|
+
helpText="Start typing to load options dynamically"
|
|
95
|
+
type="async"
|
|
96
|
+
selectProps={{
|
|
97
|
+
cacheOptions: true,
|
|
98
|
+
defaultOptions: true,
|
|
99
|
+
isClearable: true,
|
|
100
|
+
loadOptions,
|
|
101
|
+
menuIsOpen: props.selectProps?.menuIsOpen,
|
|
102
|
+
placeholder: 'Type to search...',
|
|
103
|
+
}}
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export default Component;
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Clean
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
115
|
+
|
|
116
|
+
import { Select } from '@neo4j-ndl/react';
|
|
117
|
+
|
|
118
|
+
const EXAMPLE_OPTIONS = [
|
|
119
|
+
{ label: 'Neo4j', value: 'neo4j' },
|
|
120
|
+
{ label: 'Needle 🪡', value: 'needle' },
|
|
121
|
+
{ label: 'Graph Databases', value: 'graph-database' },
|
|
122
|
+
{ isDisabled: true, label: 'Disabled database option', value: 'disabled' },
|
|
123
|
+
];
|
|
124
|
+
|
|
125
|
+
const Component = (props: React.ComponentProps<typeof Select>) => {
|
|
126
|
+
return (
|
|
127
|
+
<Select
|
|
128
|
+
label="Label"
|
|
129
|
+
type="select"
|
|
130
|
+
isClean={true}
|
|
131
|
+
isFluid={false}
|
|
132
|
+
selectProps={{
|
|
133
|
+
menuIsOpen: props.selectProps?.menuIsOpen,
|
|
134
|
+
options: EXAMPLE_OPTIONS,
|
|
135
|
+
}}
|
|
136
|
+
/>
|
|
137
|
+
);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export default Component;
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Controlled
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
import { Select, Typography } from '@neo4j-ndl/react';
|
|
147
|
+
import { useState } from 'react';
|
|
148
|
+
|
|
149
|
+
const EXAMPLE_OPTIONS = [
|
|
150
|
+
{ label: 'Neo4j', value: 'neo4j' },
|
|
151
|
+
{ label: 'Needle 🪡', value: 'needle' },
|
|
152
|
+
{ label: 'Graph Databases', value: 'graph-database' },
|
|
153
|
+
{ isDisabled: true, label: 'Disabled database option', value: 'disabled' },
|
|
154
|
+
];
|
|
155
|
+
|
|
156
|
+
const Component = (props: React.ComponentProps<typeof Select>) => {
|
|
157
|
+
const [value, setValue] = useState<(typeof EXAMPLE_OPTIONS)[number]>(
|
|
158
|
+
EXAMPLE_OPTIONS[0],
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<div className="n-flex n-flex-col n-gap-token-8">
|
|
163
|
+
<Select
|
|
164
|
+
label="Label"
|
|
165
|
+
type="select"
|
|
166
|
+
selectProps={{
|
|
167
|
+
isMulti: false,
|
|
168
|
+
menuIsOpen: props.selectProps?.menuIsOpen,
|
|
169
|
+
menuPortalTarget: document.querySelector('body'),
|
|
170
|
+
onChange: (newValue) => newValue && setValue(newValue),
|
|
171
|
+
options: EXAMPLE_OPTIONS,
|
|
172
|
+
value: value,
|
|
173
|
+
}}
|
|
174
|
+
/>
|
|
175
|
+
<Typography variant="body-small">
|
|
176
|
+
Value Selected: {JSON.stringify(value)}
|
|
177
|
+
</Typography>
|
|
178
|
+
</div>
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export default Component;
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Creatable
|
|
186
|
+
|
|
187
|
+
```tsx
|
|
188
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
189
|
+
|
|
190
|
+
import { Select } from '@neo4j-ndl/react';
|
|
191
|
+
|
|
192
|
+
const EXAMPLE_OPTIONS = [
|
|
193
|
+
{ label: 'Neo4j', value: 'neo4j' },
|
|
194
|
+
{ label: 'Needle 🪡', value: 'needle' },
|
|
195
|
+
{ label: 'Graph Databases', value: 'graph-database' },
|
|
196
|
+
{ isDisabled: true, label: 'Disabled database option', value: 'disabled' },
|
|
197
|
+
];
|
|
198
|
+
|
|
199
|
+
const Component = (props: React.ComponentProps<typeof Select>) => {
|
|
200
|
+
return (
|
|
201
|
+
<Select
|
|
202
|
+
label="Label"
|
|
203
|
+
helpText="You can create values even if they don't exist as options"
|
|
204
|
+
type="creatable"
|
|
205
|
+
selectProps={{
|
|
206
|
+
isClearable: true,
|
|
207
|
+
menuIsOpen: props.selectProps?.menuIsOpen,
|
|
208
|
+
options: EXAMPLE_OPTIONS,
|
|
209
|
+
}}
|
|
210
|
+
/>
|
|
211
|
+
);
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export default Component;
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Custom Label
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
221
|
+
|
|
222
|
+
import { Select } from '@neo4j-ndl/react';
|
|
223
|
+
import { QuestionMarkCircleIconOutline } from '@neo4j-ndl/react/icons';
|
|
224
|
+
|
|
225
|
+
const EXAMPLE_OPTIONS = [
|
|
226
|
+
{ label: 'Neo4j', value: 'neo4j' },
|
|
227
|
+
{ label: 'Needle 🪡', value: 'needle' },
|
|
228
|
+
{ label: 'Graph Databases', value: 'graph-database' },
|
|
229
|
+
{ isDisabled: true, label: 'Disabled database option', value: 'disabled' },
|
|
230
|
+
];
|
|
231
|
+
const Component = (props: React.ComponentProps<typeof Select>) => {
|
|
232
|
+
return (
|
|
233
|
+
<Select
|
|
234
|
+
label={
|
|
235
|
+
<div className="n-flex n-flex-row n-gap-token-4 n-h-7 n-items-center">
|
|
236
|
+
Custom JSX element
|
|
237
|
+
<QuestionMarkCircleIconOutline className="n-h-token-16" />
|
|
238
|
+
</div>
|
|
239
|
+
}
|
|
240
|
+
helpText="You can have a custom label with JSX code 😱"
|
|
241
|
+
type="select"
|
|
242
|
+
selectProps={{
|
|
243
|
+
defaultValue: EXAMPLE_OPTIONS[1],
|
|
244
|
+
menuIsOpen: props.selectProps?.menuIsOpen,
|
|
245
|
+
options: EXAMPLE_OPTIONS,
|
|
246
|
+
}}
|
|
247
|
+
/>
|
|
248
|
+
);
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
export default Component;
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Disabled
|
|
255
|
+
|
|
256
|
+
```tsx
|
|
257
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
258
|
+
|
|
259
|
+
import { Select } from '@neo4j-ndl/react';
|
|
260
|
+
|
|
261
|
+
const EXAMPLE_OPTIONS = [
|
|
262
|
+
{ label: 'Neo4j', value: 'neo4j' },
|
|
263
|
+
{ label: 'Needle 🪡', value: 'needle' },
|
|
264
|
+
{ label: 'Graph Databases', value: 'graph-database' },
|
|
265
|
+
{ isDisabled: true, label: 'Disabled database option', value: 'disabled' },
|
|
266
|
+
];
|
|
267
|
+
|
|
268
|
+
const Component = (props: React.ComponentProps<typeof Select>) => {
|
|
269
|
+
return (
|
|
270
|
+
<Select
|
|
271
|
+
label="Label"
|
|
272
|
+
type="select"
|
|
273
|
+
selectProps={{
|
|
274
|
+
isDisabled: true,
|
|
275
|
+
menuIsOpen: props.selectProps?.menuIsOpen,
|
|
276
|
+
options: EXAMPLE_OPTIONS,
|
|
277
|
+
}}
|
|
278
|
+
/>
|
|
279
|
+
);
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
export default Component;
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Empty
|
|
286
|
+
|
|
287
|
+
```tsx
|
|
288
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
289
|
+
|
|
290
|
+
import { Select } from '@neo4j-ndl/react';
|
|
291
|
+
|
|
292
|
+
const Component = (props: React.ComponentProps<typeof Select>) => {
|
|
293
|
+
return (
|
|
294
|
+
<Select
|
|
295
|
+
label="Label"
|
|
296
|
+
helpText="Help text"
|
|
297
|
+
type="select"
|
|
298
|
+
selectProps={{
|
|
299
|
+
menuIsOpen: props.selectProps?.menuIsOpen,
|
|
300
|
+
options: [],
|
|
301
|
+
}}
|
|
302
|
+
/>
|
|
303
|
+
);
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
export default Component;
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Error State
|
|
310
|
+
|
|
311
|
+
```tsx
|
|
312
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
313
|
+
|
|
314
|
+
import { Select } from '@neo4j-ndl/react';
|
|
315
|
+
|
|
316
|
+
const EXAMPLE_OPTIONS = [
|
|
317
|
+
{ label: 'Neo4j', value: 'neo4j' },
|
|
318
|
+
{ label: 'Needle 🪡', value: 'needle' },
|
|
319
|
+
{ label: 'Graph Databases', value: 'graph-database' },
|
|
320
|
+
{ isDisabled: true, label: 'Disabled database option', value: 'disabled' },
|
|
321
|
+
];
|
|
322
|
+
|
|
323
|
+
const Component = (props: React.ComponentProps<typeof Select>) => {
|
|
324
|
+
return (
|
|
325
|
+
<Select
|
|
326
|
+
label="Label"
|
|
327
|
+
errorText="Validate that your selection is correct"
|
|
328
|
+
type="select"
|
|
329
|
+
selectProps={{
|
|
330
|
+
menuIsOpen: props.selectProps?.menuIsOpen,
|
|
331
|
+
options: EXAMPLE_OPTIONS,
|
|
332
|
+
}}
|
|
333
|
+
/>
|
|
334
|
+
);
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
export default Component;
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Inside Dialog
|
|
341
|
+
|
|
342
|
+
```tsx
|
|
343
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
344
|
+
|
|
345
|
+
import { Dialog, FilledButton, Select, Typography } from '@neo4j-ndl/react';
|
|
346
|
+
import { useRef, useState } from 'react';
|
|
347
|
+
|
|
348
|
+
const EXAMPLE_OPTIONS = [
|
|
349
|
+
{ label: 'Neo4j', value: 'neo4j' },
|
|
350
|
+
{ label: 'Needle 🪡', value: 'needle' },
|
|
351
|
+
{ label: 'Graph Databases', value: 'graph-database' },
|
|
352
|
+
{ isDisabled: true, label: 'Disabled database option', value: 'disabled' },
|
|
353
|
+
];
|
|
354
|
+
|
|
355
|
+
const Component = (props: React.ComponentProps<typeof Select>) => {
|
|
356
|
+
const ref = useRef<HTMLDivElement | null>(null);
|
|
357
|
+
const [isOpen, setIsOpen] = useState<boolean>(false);
|
|
358
|
+
|
|
359
|
+
return (
|
|
360
|
+
<div
|
|
361
|
+
ref={ref}
|
|
362
|
+
className="n-flex n-flex-col n-items-center n-justify-center n-relative n-h-[500px]"
|
|
363
|
+
>
|
|
364
|
+
<FilledButton size="medium" onClick={() => setIsOpen(true)}>
|
|
365
|
+
Open Dialog
|
|
366
|
+
</FilledButton>
|
|
367
|
+
<Dialog
|
|
368
|
+
container={ref?.current || undefined}
|
|
369
|
+
isOpen={isOpen}
|
|
370
|
+
onClose={() => setIsOpen(false)}
|
|
371
|
+
aria-label="Dialog"
|
|
372
|
+
>
|
|
373
|
+
<Dialog.Header>Using Select inside a dialog</Dialog.Header>
|
|
374
|
+
<Dialog.Description className="n-flex n-flex-col n-gap-token-32">
|
|
375
|
+
<Typography variant="body-medium">
|
|
376
|
+
To use select inside a dialog and avoid the cut-off, you need to use
|
|
377
|
+
the property <code>menuPosition: "fixed"</code> inside the{' '}
|
|
378
|
+
<code>selectProps</code>. This is done automatically if used in a
|
|
379
|
+
Needle Dialog, but can always be overridden manually.
|
|
380
|
+
</Typography>
|
|
381
|
+
<Select
|
|
382
|
+
label="Inside a dialog"
|
|
383
|
+
type="select"
|
|
384
|
+
selectProps={{
|
|
385
|
+
defaultValue: EXAMPLE_OPTIONS[1],
|
|
386
|
+
menuIsOpen: props.selectProps?.menuIsOpen,
|
|
387
|
+
options: EXAMPLE_OPTIONS,
|
|
388
|
+
}}
|
|
389
|
+
/>
|
|
390
|
+
</Dialog.Description>
|
|
391
|
+
</Dialog>
|
|
392
|
+
</div>
|
|
393
|
+
);
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
export default Component;
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### Menu Positionings
|
|
400
|
+
|
|
401
|
+
```tsx
|
|
402
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
403
|
+
|
|
404
|
+
import { Select } from '@neo4j-ndl/react';
|
|
405
|
+
|
|
406
|
+
const EXAMPLE_OPTIONS = [
|
|
407
|
+
{ label: 'Neo4j', value: 'neo4j' },
|
|
408
|
+
{ label: 'Needle 🪡', value: 'needle' },
|
|
409
|
+
];
|
|
410
|
+
|
|
411
|
+
const Component = (props: React.ComponentProps<typeof Select>) => {
|
|
412
|
+
return (
|
|
413
|
+
<div className="n-flex n-gap-token-16 n-pt-token-64">
|
|
414
|
+
<Select
|
|
415
|
+
label="Automatic menu placement"
|
|
416
|
+
type="select"
|
|
417
|
+
selectProps={{
|
|
418
|
+
menuIsOpen: props.selectProps?.menuIsOpen,
|
|
419
|
+
menuPlacement: 'auto',
|
|
420
|
+
options: EXAMPLE_OPTIONS,
|
|
421
|
+
}}
|
|
422
|
+
/>
|
|
423
|
+
<Select
|
|
424
|
+
label="Bottom menu placement"
|
|
425
|
+
type="select"
|
|
426
|
+
selectProps={{
|
|
427
|
+
menuIsOpen: props.selectProps?.menuIsOpen,
|
|
428
|
+
menuPlacement: 'bottom',
|
|
429
|
+
options: EXAMPLE_OPTIONS,
|
|
430
|
+
}}
|
|
431
|
+
/>
|
|
432
|
+
<Select
|
|
433
|
+
label="Top menu placement"
|
|
434
|
+
type="select"
|
|
435
|
+
selectProps={{
|
|
436
|
+
menuIsOpen: props.selectProps?.menuIsOpen,
|
|
437
|
+
menuPlacement: 'top',
|
|
438
|
+
options: EXAMPLE_OPTIONS,
|
|
439
|
+
}}
|
|
440
|
+
/>
|
|
441
|
+
</div>
|
|
442
|
+
);
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
export default Component;
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
### Multi
|
|
449
|
+
|
|
450
|
+
```tsx
|
|
451
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
452
|
+
|
|
453
|
+
import { Select } from '@neo4j-ndl/react';
|
|
454
|
+
|
|
455
|
+
const EXAMPLE_OPTIONS = [
|
|
456
|
+
{ label: 'Neo4j', value: 'neo4j' },
|
|
457
|
+
{ label: 'Needle 🪡', value: 'needle' },
|
|
458
|
+
{ label: 'Graph Databases', value: 'graph-database' },
|
|
459
|
+
{ isDisabled: true, label: 'Disabled database option', value: 'disabled' },
|
|
460
|
+
];
|
|
461
|
+
|
|
462
|
+
const Component = (props: React.ComponentProps<typeof Select>) => {
|
|
463
|
+
return (
|
|
464
|
+
<Select
|
|
465
|
+
label="Label"
|
|
466
|
+
type="select"
|
|
467
|
+
selectProps={{
|
|
468
|
+
defaultValue: EXAMPLE_OPTIONS[1],
|
|
469
|
+
isClearable: true,
|
|
470
|
+
isMulti: true,
|
|
471
|
+
menuIsOpen: props.selectProps?.menuIsOpen,
|
|
472
|
+
options: EXAMPLE_OPTIONS,
|
|
473
|
+
}}
|
|
474
|
+
/>
|
|
475
|
+
);
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
export default Component;
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
### Sizes
|
|
482
|
+
|
|
483
|
+
```tsx
|
|
484
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
485
|
+
|
|
486
|
+
import { Select } from '@neo4j-ndl/react';
|
|
487
|
+
|
|
488
|
+
const EXAMPLE_OPTIONS = [
|
|
489
|
+
{ label: 'Neo4j', value: 'neo4j' },
|
|
490
|
+
{ label: 'Needle 🪡', value: 'needle' },
|
|
491
|
+
{ label: 'Graph Databases', value: 'graph-database' },
|
|
492
|
+
{ isDisabled: true, label: 'Disabled database option', value: 'disabled' },
|
|
493
|
+
];
|
|
494
|
+
|
|
495
|
+
const Component = (props: React.ComponentProps<typeof Select>) => {
|
|
496
|
+
return (
|
|
497
|
+
<div className="n-flex n-gap-token-16">
|
|
498
|
+
<Select
|
|
499
|
+
label="Small"
|
|
500
|
+
type="select"
|
|
501
|
+
size="small"
|
|
502
|
+
selectProps={{
|
|
503
|
+
menuIsOpen: props.selectProps?.menuIsOpen,
|
|
504
|
+
options: EXAMPLE_OPTIONS,
|
|
505
|
+
}}
|
|
506
|
+
/>
|
|
507
|
+
<Select
|
|
508
|
+
label="Medium"
|
|
509
|
+
type="select"
|
|
510
|
+
size="medium"
|
|
511
|
+
selectProps={{
|
|
512
|
+
menuIsOpen: props.selectProps?.menuIsOpen,
|
|
513
|
+
options: EXAMPLE_OPTIONS,
|
|
514
|
+
}}
|
|
515
|
+
/>
|
|
516
|
+
<Select
|
|
517
|
+
label="Large"
|
|
518
|
+
type="select"
|
|
519
|
+
size="large"
|
|
520
|
+
selectProps={{
|
|
521
|
+
menuIsOpen: props.selectProps?.menuIsOpen,
|
|
522
|
+
options: EXAMPLE_OPTIONS,
|
|
523
|
+
}}
|
|
524
|
+
/>
|
|
525
|
+
</div>
|
|
526
|
+
);
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
export default Component;
|
|
530
|
+
```
|