@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,433 @@
|
|
|
1
|
+
# Tabs
|
|
2
|
+
|
|
3
|
+
Import: `import { Tabs } from '@neo4j-ndl/react'`
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### Tabs
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Required | Default | Description |
|
|
10
|
+
|------|------|----------|---------|-------------|
|
|
11
|
+
| `as` | `ElementType<any, keyof IntrinsicElements>` | | | An override of the default HTML tag of the root of the component. Can also be another React component. |
|
|
12
|
+
| `children` | `ReactNode` | ✅ | | The content dislayed in the tabs |
|
|
13
|
+
| `fill` | `'filled' \| 'underline'` | | `underline` | The fill type of the tabs |
|
|
14
|
+
| `onBackground` | `'default' \| 'weak'` | | `weak` | What background the Tabs is placed on. This affects the gradient background of the scroll navigation buttons. |
|
|
15
|
+
| `onChange` | `(e: U) => void` | ✅ | | Callback function triggered when a new tab is selected |
|
|
16
|
+
| `ref` | `any` | | | A ref to apply to the root element. |
|
|
17
|
+
| `size` | `'large' \| 'small'` | | `large` | The size of the tabs |
|
|
18
|
+
| `value` | `string` | ✅ | | The currently active tabId |
|
|
19
|
+
|
|
20
|
+
### Tabs.Badge
|
|
21
|
+
|
|
22
|
+
| Prop | Type | Required | Default | Description |
|
|
23
|
+
|------|------|----------|---------|-------------|
|
|
24
|
+
| `children` | `ReactNode` | ✅ | | The content of the badge |
|
|
25
|
+
| `ref` | `Ref<HTMLSpanElement>` | | | A ref to apply to the root element. |
|
|
26
|
+
|
|
27
|
+
### Tabs.Tab
|
|
28
|
+
|
|
29
|
+
| Prop | Type | Required | Default | Description |
|
|
30
|
+
|------|------|----------|---------|-------------|
|
|
31
|
+
| `as` | `ElementType<any, keyof IntrinsicElements>` | | | An override of the default HTML tag of the root of the component. Can also be another React component. |
|
|
32
|
+
| `children` | `ReactNode` | ✅ | | The content of the tab |
|
|
33
|
+
| `description` | `string` | | | A string that will be shown as a tooltip when hovering over the button it also acts as an aria-label- {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label} |
|
|
34
|
+
| `id` | `string` | ✅ | | The id of the tab |
|
|
35
|
+
| `isDisabled` | `boolean` | | `false` | Whether the tab is disabled |
|
|
36
|
+
| `ref` | `any` | | | A ref to apply to the root element. |
|
|
37
|
+
| `tooltipProps` | `TooltipObjectProps` | | | Props for the tooltip component. |
|
|
38
|
+
|
|
39
|
+
When the `description` prop is set, hovering over the tab will show a tooltip with the text provided in the `description` prop. `tooltipProps` can be used to customize the tooltip appearance. The `TooltipObjectProps` type is defined as: `{ root?: Partial<React.ComponentProps<typeof Tooltip>>; trigger?: Partial<React.ComponentProps<typeof Tooltip.Trigger>>; content?: Partial<React.ComponentProps<typeof Tooltip.Content>>; }`, see the Tooltip component for more details.
|
|
40
|
+
|
|
41
|
+
### Tabs.TabPanel
|
|
42
|
+
|
|
43
|
+
| Prop | Type | Required | Default | Description |
|
|
44
|
+
|------|------|----------|---------|-------------|
|
|
45
|
+
| `as` | `ElementType<any, keyof IntrinsicElements>` | | | An override of the default HTML tag of the root of the component. Can also be another React component. |
|
|
46
|
+
| `children` | `ReactNode` | ✅ | | The content displayed in the tab panel |
|
|
47
|
+
| `ref` | `any` | | | A ref to apply to the root element. |
|
|
48
|
+
| `tabId` | `string` | ✅ | | The id of the tab panel |
|
|
49
|
+
| `value` | `string` | ✅ | | The currently selected tabId. The tab is visible if the value is equal to the tabId |
|
|
50
|
+
|
|
51
|
+
## Accessibility
|
|
52
|
+
|
|
53
|
+
## Implementation guidelines
|
|
54
|
+
|
|
55
|
+
The tabs is using the `role='tablist'` to convey related selection options and keyboard navigation is supported using the `role='tab'` and `role='tabpanel'`. It's important to give each tab an id and each tab panel an id.
|
|
56
|
+
|
|
57
|
+
## Examples
|
|
58
|
+
|
|
59
|
+
### Default
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
63
|
+
|
|
64
|
+
import { Tabs, Typography } from '@neo4j-ndl/react';
|
|
65
|
+
import { useState } from 'react';
|
|
66
|
+
|
|
67
|
+
type TabValues = '0' | '1' | '2';
|
|
68
|
+
|
|
69
|
+
const Component = () => {
|
|
70
|
+
const [value, setValue] = useState<TabValues>('0');
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<div>
|
|
74
|
+
<Tabs value={value} onChange={setValue} className="n-mb-token-8">
|
|
75
|
+
<Tabs.Tab id="0">Tab 1</Tabs.Tab>
|
|
76
|
+
<Tabs.Tab id="1">Tab 2</Tabs.Tab>
|
|
77
|
+
<Tabs.Tab id="2">Tab 3</Tabs.Tab>
|
|
78
|
+
</Tabs>
|
|
79
|
+
<Tabs.TabPanel value={value} tabId="0">
|
|
80
|
+
<Typography variant="body-medium">Tab 1 content</Typography>
|
|
81
|
+
</Tabs.TabPanel>
|
|
82
|
+
<Tabs.TabPanel value={value} tabId="1">
|
|
83
|
+
<Typography variant="body-medium">Tab 2 content</Typography>
|
|
84
|
+
</Tabs.TabPanel>
|
|
85
|
+
<Tabs.TabPanel value={value} tabId="2">
|
|
86
|
+
<Typography variant="body-medium">Tab 3 content</Typography>
|
|
87
|
+
</Tabs.TabPanel>
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export default Component;
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Badge
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
99
|
+
|
|
100
|
+
import { Tabs, Typography } from '@neo4j-ndl/react';
|
|
101
|
+
import { useState } from 'react';
|
|
102
|
+
|
|
103
|
+
type TabValues = '0' | '1' | '2';
|
|
104
|
+
|
|
105
|
+
const Component = () => {
|
|
106
|
+
const [value, setValue] = useState<TabValues>('0');
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<div>
|
|
110
|
+
<Tabs value={value} onChange={setValue} className="n-mb-token-8">
|
|
111
|
+
<Tabs.Tab id="0">Tab 1</Tabs.Tab>
|
|
112
|
+
<Tabs.Tab id="1">
|
|
113
|
+
Tab 2 <Tabs.Badge>5</Tabs.Badge>
|
|
114
|
+
</Tabs.Tab>
|
|
115
|
+
<Tabs.Tab id="2">Tab 3</Tabs.Tab>
|
|
116
|
+
</Tabs>
|
|
117
|
+
<Tabs.TabPanel value={value} tabId="0">
|
|
118
|
+
<Typography variant="body-medium">Tab 1 content</Typography>
|
|
119
|
+
</Tabs.TabPanel>
|
|
120
|
+
<Tabs.TabPanel value={value} tabId="1">
|
|
121
|
+
<Typography variant="body-medium">Tab 2 content</Typography>
|
|
122
|
+
</Tabs.TabPanel>
|
|
123
|
+
<Tabs.TabPanel value={value} tabId="2">
|
|
124
|
+
<Typography variant="body-medium">Tab 3 content</Typography>
|
|
125
|
+
</Tabs.TabPanel>
|
|
126
|
+
</div>
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export default Component;
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Disabled
|
|
134
|
+
|
|
135
|
+
```tsx
|
|
136
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
137
|
+
|
|
138
|
+
import { Tabs, Typography } from '@neo4j-ndl/react';
|
|
139
|
+
import { useState } from 'react';
|
|
140
|
+
|
|
141
|
+
type TabValues = '0' | '1' | '2';
|
|
142
|
+
|
|
143
|
+
const Component = () => {
|
|
144
|
+
const [value, setValue] = useState<TabValues>('0');
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<div>
|
|
148
|
+
<Tabs value={value} onChange={setValue} className="n-mb-token-8">
|
|
149
|
+
<Tabs.Tab id="0">Tab 1</Tabs.Tab>
|
|
150
|
+
<Tabs.Tab id="1">Tab 2</Tabs.Tab>
|
|
151
|
+
<Tabs.Tab id="2" isDisabled={true}>
|
|
152
|
+
Tab 3
|
|
153
|
+
</Tabs.Tab>
|
|
154
|
+
</Tabs>
|
|
155
|
+
<Tabs.TabPanel value={value} tabId="0">
|
|
156
|
+
<Typography variant="body-medium">Tab 1 content</Typography>
|
|
157
|
+
</Tabs.TabPanel>
|
|
158
|
+
<Tabs.TabPanel value={value} tabId="1">
|
|
159
|
+
<Typography variant="body-medium">Tab 2 content</Typography>
|
|
160
|
+
</Tabs.TabPanel>
|
|
161
|
+
<Tabs.TabPanel value={value} tabId="2">
|
|
162
|
+
<Typography variant="body-medium">Tab 3 content</Typography>
|
|
163
|
+
</Tabs.TabPanel>
|
|
164
|
+
</div>
|
|
165
|
+
);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export default Component;
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Fill Variants
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
175
|
+
|
|
176
|
+
import { Tabs, Typography } from '@neo4j-ndl/react';
|
|
177
|
+
import { useState } from 'react';
|
|
178
|
+
|
|
179
|
+
type TabValues = '0' | '1' | '2';
|
|
180
|
+
|
|
181
|
+
const Component = () => {
|
|
182
|
+
const [underlineValue, setUnderlineValue] = useState<TabValues>('0');
|
|
183
|
+
const [filledValue, setFilledValue] = useState<TabValues>('0');
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
<div className="n-flex n-gap-token-8">
|
|
187
|
+
<div className="n-flex n-flex-col n-gap-token-32">
|
|
188
|
+
<Typography variant="label">Underline (Default)</Typography>
|
|
189
|
+
<div>
|
|
190
|
+
<Tabs
|
|
191
|
+
value={underlineValue}
|
|
192
|
+
onChange={setUnderlineValue}
|
|
193
|
+
className="n-mb-token-8"
|
|
194
|
+
>
|
|
195
|
+
<Tabs.Tab id="0">Tab 1</Tabs.Tab>
|
|
196
|
+
<Tabs.Tab id="1">Tab 2</Tabs.Tab>
|
|
197
|
+
<Tabs.Tab id="2">Tab 3</Tabs.Tab>
|
|
198
|
+
</Tabs>
|
|
199
|
+
<Tabs.TabPanel value={underlineValue} tabId="0">
|
|
200
|
+
<Typography variant="body-medium">Tab 1 content</Typography>
|
|
201
|
+
</Tabs.TabPanel>
|
|
202
|
+
<Tabs.TabPanel value={underlineValue} tabId="1">
|
|
203
|
+
<Typography variant="body-medium">Tab 2 content</Typography>
|
|
204
|
+
</Tabs.TabPanel>
|
|
205
|
+
<Tabs.TabPanel value={underlineValue} tabId="2">
|
|
206
|
+
<Typography variant="body-medium">Tab 3 content</Typography>
|
|
207
|
+
</Tabs.TabPanel>
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
|
|
211
|
+
<div className="n-flex n-flex-col n-gap-token-8">
|
|
212
|
+
<Typography variant="label">Filled</Typography>
|
|
213
|
+
<div>
|
|
214
|
+
<Tabs
|
|
215
|
+
value={filledValue}
|
|
216
|
+
onChange={setFilledValue}
|
|
217
|
+
fill="filled"
|
|
218
|
+
className="n-mb-token-8"
|
|
219
|
+
>
|
|
220
|
+
<Tabs.Tab id="0">Tab 1</Tabs.Tab>
|
|
221
|
+
<Tabs.Tab id="1">Tab 2</Tabs.Tab>
|
|
222
|
+
<Tabs.Tab id="2">Tab 3</Tabs.Tab>
|
|
223
|
+
</Tabs>
|
|
224
|
+
<Tabs.TabPanel value={filledValue} tabId="0">
|
|
225
|
+
<Typography variant="body-medium">Tab 1 content</Typography>
|
|
226
|
+
</Tabs.TabPanel>
|
|
227
|
+
<Tabs.TabPanel value={filledValue} tabId="1">
|
|
228
|
+
<Typography variant="body-medium">Tab 2 content</Typography>
|
|
229
|
+
</Tabs.TabPanel>
|
|
230
|
+
<Tabs.TabPanel value={filledValue} tabId="2">
|
|
231
|
+
<Typography variant="body-medium">Tab 3 content</Typography>
|
|
232
|
+
</Tabs.TabPanel>
|
|
233
|
+
</div>
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
);
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export default Component;
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Overflow
|
|
243
|
+
|
|
244
|
+
```tsx
|
|
245
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
246
|
+
|
|
247
|
+
import { Tabs, Typography } from '@neo4j-ndl/react';
|
|
248
|
+
import { useState } from 'react';
|
|
249
|
+
|
|
250
|
+
const Component = () => {
|
|
251
|
+
const [value, setValue] = useState<string>('0');
|
|
252
|
+
|
|
253
|
+
return (
|
|
254
|
+
<div className="n-w-80">
|
|
255
|
+
<Tabs value={value} onChange={setValue} className="n-mb-token-8">
|
|
256
|
+
<Tabs.Tab id="0">Tab 1</Tabs.Tab>
|
|
257
|
+
<Tabs.Tab id="1">Tab 2</Tabs.Tab>
|
|
258
|
+
<Tabs.Tab id="2">Tab 3</Tabs.Tab>
|
|
259
|
+
<Tabs.Tab id="3">Tab 4</Tabs.Tab>
|
|
260
|
+
<Tabs.Tab id="4">Tab 5</Tabs.Tab>
|
|
261
|
+
<Tabs.Tab id="5">Tab 6</Tabs.Tab>
|
|
262
|
+
<Tabs.Tab id="6">Tab 7</Tabs.Tab>
|
|
263
|
+
<Tabs.Tab id="7">Tab 8</Tabs.Tab>
|
|
264
|
+
<Tabs.Tab id="8">Tab 9</Tabs.Tab>
|
|
265
|
+
<Tabs.Tab id="9">
|
|
266
|
+
Tab 10 is waay too long and will be cut off on smaller screens
|
|
267
|
+
</Tabs.Tab>
|
|
268
|
+
</Tabs>
|
|
269
|
+
<Tabs.TabPanel value={value} tabId="0">
|
|
270
|
+
<Typography variant="body-medium">Tab 1 content</Typography>
|
|
271
|
+
</Tabs.TabPanel>
|
|
272
|
+
<Tabs.TabPanel value={value} tabId="1">
|
|
273
|
+
<Typography variant="body-medium">Tab 2 content</Typography>
|
|
274
|
+
</Tabs.TabPanel>
|
|
275
|
+
<Tabs.TabPanel value={value} tabId="2">
|
|
276
|
+
<Typography variant="body-medium">Tab 3 content</Typography>
|
|
277
|
+
</Tabs.TabPanel>
|
|
278
|
+
<Tabs.TabPanel value={value} tabId="3">
|
|
279
|
+
<Typography variant="body-medium">Tab 4 content</Typography>
|
|
280
|
+
</Tabs.TabPanel>
|
|
281
|
+
<Tabs.TabPanel value={value} tabId="4">
|
|
282
|
+
<Typography variant="body-medium">Tab 5 content</Typography>
|
|
283
|
+
</Tabs.TabPanel>
|
|
284
|
+
<Tabs.TabPanel value={value} tabId="5">
|
|
285
|
+
<Typography variant="body-medium">Tab 6 content</Typography>
|
|
286
|
+
</Tabs.TabPanel>
|
|
287
|
+
<Tabs.TabPanel value={value} tabId="6">
|
|
288
|
+
<Typography variant="body-medium">Tab 7 content</Typography>
|
|
289
|
+
</Tabs.TabPanel>
|
|
290
|
+
<Tabs.TabPanel value={value} tabId="7">
|
|
291
|
+
<Typography variant="body-medium">Tab 8 content</Typography>
|
|
292
|
+
</Tabs.TabPanel>
|
|
293
|
+
<Tabs.TabPanel value={value} tabId="8">
|
|
294
|
+
<Typography variant="body-medium">Tab 9 content</Typography>
|
|
295
|
+
</Tabs.TabPanel>
|
|
296
|
+
<Tabs.TabPanel value={value} tabId="9">
|
|
297
|
+
<Typography variant="body-medium">Tab 10 content</Typography>
|
|
298
|
+
</Tabs.TabPanel>
|
|
299
|
+
</div>
|
|
300
|
+
);
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
export default Component;
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Sizes
|
|
307
|
+
|
|
308
|
+
```tsx
|
|
309
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
310
|
+
|
|
311
|
+
import { Tabs, Typography } from '@neo4j-ndl/react';
|
|
312
|
+
import { useState } from 'react';
|
|
313
|
+
|
|
314
|
+
type TabValues = '0' | '1' | '2';
|
|
315
|
+
|
|
316
|
+
const Component = () => {
|
|
317
|
+
const [smallValue, setSmallValue] = useState<TabValues>('0');
|
|
318
|
+
const [largeValue, setLargeValue] = useState<TabValues>('0');
|
|
319
|
+
|
|
320
|
+
return (
|
|
321
|
+
<div className="n-flex n-gap-token-8">
|
|
322
|
+
<div className="n-flex n-flex-col n-gap-token-8">
|
|
323
|
+
<Typography variant="label">Small Size</Typography>
|
|
324
|
+
<div className="n-w-fit">
|
|
325
|
+
<Tabs
|
|
326
|
+
value={smallValue}
|
|
327
|
+
onChange={setSmallValue}
|
|
328
|
+
size="small"
|
|
329
|
+
className="n-mb-token-8"
|
|
330
|
+
>
|
|
331
|
+
<Tabs.Tab id="0">Tab 1</Tabs.Tab>
|
|
332
|
+
<Tabs.Tab id="1">Tab 2</Tabs.Tab>
|
|
333
|
+
<Tabs.Tab id="2">Tab 3</Tabs.Tab>
|
|
334
|
+
</Tabs>
|
|
335
|
+
<Tabs.TabPanel value={smallValue} tabId="0">
|
|
336
|
+
<Typography variant="body-small">
|
|
337
|
+
Content for small tab 1
|
|
338
|
+
</Typography>
|
|
339
|
+
</Tabs.TabPanel>
|
|
340
|
+
<Tabs.TabPanel value={smallValue} tabId="1">
|
|
341
|
+
<Typography variant="body-small">
|
|
342
|
+
Content for small tab 2
|
|
343
|
+
</Typography>
|
|
344
|
+
</Tabs.TabPanel>
|
|
345
|
+
<Tabs.TabPanel value={smallValue} tabId="2">
|
|
346
|
+
<Typography variant="body-small">
|
|
347
|
+
Content for small tab 3
|
|
348
|
+
</Typography>
|
|
349
|
+
</Tabs.TabPanel>
|
|
350
|
+
</div>
|
|
351
|
+
</div>
|
|
352
|
+
|
|
353
|
+
<div className="n-flex n-flex-col n-gap-token-8">
|
|
354
|
+
<Typography variant="label">Large Size (Default)</Typography>
|
|
355
|
+
<Tabs
|
|
356
|
+
value={largeValue}
|
|
357
|
+
onChange={setLargeValue}
|
|
358
|
+
size="large"
|
|
359
|
+
className="n-mb-token-8"
|
|
360
|
+
>
|
|
361
|
+
<Tabs.Tab id="0">Tab 1</Tabs.Tab>
|
|
362
|
+
<Tabs.Tab id="1">Tab 2</Tabs.Tab>
|
|
363
|
+
<Tabs.Tab id="2">Tab 3</Tabs.Tab>
|
|
364
|
+
</Tabs>
|
|
365
|
+
<Tabs.TabPanel value={largeValue} tabId="0">
|
|
366
|
+
<Typography variant="body-medium">Content for large tab 1</Typography>
|
|
367
|
+
</Tabs.TabPanel>
|
|
368
|
+
<Tabs.TabPanel value={largeValue} tabId="1">
|
|
369
|
+
<Typography variant="body-medium">Content for large tab 2</Typography>
|
|
370
|
+
</Tabs.TabPanel>
|
|
371
|
+
<Tabs.TabPanel value={largeValue} tabId="2">
|
|
372
|
+
<Typography variant="body-medium">Content for large tab 3</Typography>
|
|
373
|
+
</Tabs.TabPanel>
|
|
374
|
+
</div>
|
|
375
|
+
</div>
|
|
376
|
+
);
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
export default Component;
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### With Icons
|
|
383
|
+
|
|
384
|
+
```tsx
|
|
385
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
386
|
+
|
|
387
|
+
import { Tabs, Typography } from '@neo4j-ndl/react';
|
|
388
|
+
import {
|
|
389
|
+
CircleStackIconOutline,
|
|
390
|
+
DatabasePlusIcon,
|
|
391
|
+
InboxArrowDownIconOutline,
|
|
392
|
+
} from '@neo4j-ndl/react/icons';
|
|
393
|
+
import { useState } from 'react';
|
|
394
|
+
|
|
395
|
+
type TabValues = 'database' | 'add' | 'inbox';
|
|
396
|
+
|
|
397
|
+
const Component = () => {
|
|
398
|
+
const [value, setValue] = useState<TabValues>('database');
|
|
399
|
+
|
|
400
|
+
return (
|
|
401
|
+
<div className="n-mt-5">
|
|
402
|
+
<Tabs value={value} onChange={setValue} className="n-mb-token-8">
|
|
403
|
+
<Tabs.Tab id="database" description="Database">
|
|
404
|
+
<CircleStackIconOutline />
|
|
405
|
+
</Tabs.Tab>
|
|
406
|
+
<Tabs.Tab id="add" description="Add database">
|
|
407
|
+
<DatabasePlusIcon />
|
|
408
|
+
</Tabs.Tab>
|
|
409
|
+
<Tabs.Tab id="inbox" description="Inbox">
|
|
410
|
+
<InboxArrowDownIconOutline />
|
|
411
|
+
</Tabs.Tab>
|
|
412
|
+
</Tabs>
|
|
413
|
+
<Tabs.TabPanel value={value} tabId="database">
|
|
414
|
+
<Typography variant="body-medium">
|
|
415
|
+
Database management and operations.
|
|
416
|
+
</Typography>
|
|
417
|
+
</Tabs.TabPanel>
|
|
418
|
+
<Tabs.TabPanel value={value} tabId="add">
|
|
419
|
+
<Typography variant="body-medium">
|
|
420
|
+
Add new database or connection.
|
|
421
|
+
</Typography>
|
|
422
|
+
</Tabs.TabPanel>
|
|
423
|
+
<Tabs.TabPanel value={value} tabId="inbox">
|
|
424
|
+
<Typography variant="body-medium">
|
|
425
|
+
Inbox notifications and messages.
|
|
426
|
+
</Typography>
|
|
427
|
+
</Tabs.TabPanel>
|
|
428
|
+
</div>
|
|
429
|
+
);
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
export default Component;
|
|
433
|
+
```
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Tag
|
|
2
|
+
|
|
3
|
+
Import: `import { Tag } from '@neo4j-ndl/react'`
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### Tag
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Required | Default | Description |
|
|
10
|
+
|------|------|----------|---------|-------------|
|
|
11
|
+
| `children` | `ReactNode` | ✅ | | The content of the tag |
|
|
12
|
+
| `onClick` | `MouseEventHandler<HTMLButtonElement>` | | | Callback function triggered when tag should be removed |
|
|
13
|
+
| `ref` | `Ref<HTMLDivElement>` | | | A ref to apply to the root element. |
|
|
14
|
+
| `size` | `'large' \| 'medium' \| 'small'` | | `medium` | Size of the tag |
|
|
15
|
+
| `type` | `'default' \| 'destructive'` | | `default` | Type of the tag |
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
### Sizes
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
23
|
+
|
|
24
|
+
import { Tag } from '@neo4j-ndl/react';
|
|
25
|
+
|
|
26
|
+
const Component = () => {
|
|
27
|
+
return (
|
|
28
|
+
<div className="n-flex n-gap-token-16 n-items-start">
|
|
29
|
+
<Tag
|
|
30
|
+
size="small"
|
|
31
|
+
onClick={() => {
|
|
32
|
+
console.info('onClick was called');
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
Small
|
|
36
|
+
</Tag>
|
|
37
|
+
<Tag
|
|
38
|
+
size="medium"
|
|
39
|
+
onClick={() => {
|
|
40
|
+
console.info('onClick was called');
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
Medium
|
|
44
|
+
</Tag>
|
|
45
|
+
<Tag
|
|
46
|
+
size="large"
|
|
47
|
+
onClick={() => {
|
|
48
|
+
console.info('onClick was called');
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
Large
|
|
52
|
+
</Tag>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export default Component;
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Types
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
64
|
+
|
|
65
|
+
import { Tag } from '@neo4j-ndl/react';
|
|
66
|
+
|
|
67
|
+
const Component = () => {
|
|
68
|
+
return (
|
|
69
|
+
<div className="n-flex n-gap-token-16">
|
|
70
|
+
<Tag
|
|
71
|
+
type="default"
|
|
72
|
+
onClick={() => {
|
|
73
|
+
console.info('onClick was called');
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
Tag
|
|
77
|
+
</Tag>
|
|
78
|
+
<Tag
|
|
79
|
+
type="destructive"
|
|
80
|
+
onClick={() => {
|
|
81
|
+
console.info('onClick was called');
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
Clear all
|
|
85
|
+
</Tag>
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export default Component;
|
|
91
|
+
```
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# TextArea
|
|
2
|
+
|
|
3
|
+
Import: `import { TextArea } from '@neo4j-ndl/react'`
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### TextArea
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Required | Default | Description |
|
|
10
|
+
|------|------|----------|---------|-------------|
|
|
11
|
+
| `ariaLabel` | `string` | | | Aria label for accessibility when no visible label is provided |
|
|
12
|
+
| `errorText` | `ReactNode` | | | Error message displayed below the textarea. When provided, it overrides `helpText` and shows an error icon |
|
|
13
|
+
| `helpText` | `ReactNode` | | | Assistive text displayed below the textarea |
|
|
14
|
+
| `isDisabled` | `boolean` | | `false` | Whether the textarea is disabled |
|
|
15
|
+
| `isFluid` | `boolean` | | `false` | Whether the textarea should take the full available width |
|
|
16
|
+
| `isOptional` | `boolean` | | `false` | Whether to display the Optional label next to the field label |
|
|
17
|
+
| `isReadOnly` | `boolean` | | `false` | Whether the textarea is read-only |
|
|
18
|
+
| `label` | `ReactNode` | | | The label displayed above the textarea |
|
|
19
|
+
| `moreInformationText` | `ReactNode` | | | Text displayed in the information tooltip shown next to the label |
|
|
20
|
+
| `placeholder` | `string` | | | Placeholder text displayed when the textarea is empty |
|
|
21
|
+
| `ref` | `Ref<HTMLTextAreaElement>` | | | A ref to apply to the root element. |
|
|
22
|
+
| `size` | `'large' \| 'medium' \| 'small'` | | `medium` | Size of the textarea |
|
|
23
|
+
| `tooltipProps` | `TooltipObjectProps` | | | Props for the Tooltip component used by the information icon |
|
|
24
|
+
| `value` | `string \| number \| readonly string[]` | | | The current value of the textarea |
|
|
25
|
+
|
|
26
|
+
When `moreInformationText` is provided, a tooltip is rendered next to the label, and the `tooltipProps` prop is used to configure the tooltip. The `TooltipObjectProps` type is defined as: `{ root?: Partial<React.ComponentProps<typeof Tooltip>>; trigger?: Partial<React.ComponentProps<typeof Tooltip.Trigger>>; content?: Partial<React.ComponentProps<typeof Tooltip.Content>>; }`, see the Tooltip component for more details.
|
|
27
|
+
|
|
28
|
+
## Accessibility
|
|
29
|
+
|
|
30
|
+
## Implementation guidelines
|
|
31
|
+
|
|
32
|
+
Please provide either a `label` or an `ariaLabel` to keep the component accessible for screen readers.
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
### Default
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
40
|
+
|
|
41
|
+
import { TextArea } from '@neo4j-ndl/react';
|
|
42
|
+
|
|
43
|
+
const Component = () => {
|
|
44
|
+
return (
|
|
45
|
+
<TextArea
|
|
46
|
+
label="Label"
|
|
47
|
+
helpText="Friendly help text"
|
|
48
|
+
placeholder="Placeholder text"
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default Component;
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Disabled
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
60
|
+
|
|
61
|
+
import { TextArea } from '@neo4j-ndl/react';
|
|
62
|
+
|
|
63
|
+
const Component = () => {
|
|
64
|
+
return <TextArea value="Example" label="Label" isDisabled={true} />;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default Component;
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Error
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
74
|
+
|
|
75
|
+
import { TextArea } from '@neo4j-ndl/react';
|
|
76
|
+
|
|
77
|
+
const Component = () => {
|
|
78
|
+
return <TextArea label="Label" errorText="This is an error message" />;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default Component;
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Fluid
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
88
|
+
|
|
89
|
+
import { TextArea } from '@neo4j-ndl/react';
|
|
90
|
+
|
|
91
|
+
const Component = () => {
|
|
92
|
+
return (
|
|
93
|
+
<TextArea label="Label" helpText="Friendly help text" isFluid={true} />
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export default Component;
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Information Icon
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
104
|
+
|
|
105
|
+
import { TextArea } from '@neo4j-ndl/react';
|
|
106
|
+
|
|
107
|
+
const Component = () => {
|
|
108
|
+
return (
|
|
109
|
+
<TextArea
|
|
110
|
+
label="Label"
|
|
111
|
+
moreInformationText="Information icon text"
|
|
112
|
+
tooltipProps={{
|
|
113
|
+
root: {
|
|
114
|
+
placement: 'right',
|
|
115
|
+
},
|
|
116
|
+
}}
|
|
117
|
+
/>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export default Component;
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Optional
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
128
|
+
|
|
129
|
+
import { TextArea } from '@neo4j-ndl/react';
|
|
130
|
+
|
|
131
|
+
const Component = () => {
|
|
132
|
+
return (
|
|
133
|
+
<TextArea label="Label" helpText="Friendly help text" isOptional={true} />
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export default Component;
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Resizable Style
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
144
|
+
|
|
145
|
+
import { TextArea } from '@neo4j-ndl/react';
|
|
146
|
+
|
|
147
|
+
const Component = () => {
|
|
148
|
+
return (
|
|
149
|
+
<TextArea
|
|
150
|
+
label="Resizable"
|
|
151
|
+
style={{ resize: 'both' }}
|
|
152
|
+
helpText="Try pulling in the corner"
|
|
153
|
+
/>
|
|
154
|
+
);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export default Component;
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Sizes
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
164
|
+
|
|
165
|
+
import { TextArea } from '@neo4j-ndl/react';
|
|
166
|
+
|
|
167
|
+
const Component = () => {
|
|
168
|
+
return (
|
|
169
|
+
<div className="n-flex n-gap-6">
|
|
170
|
+
<TextArea label="Small text area" size="small" />
|
|
171
|
+
<TextArea label="Medium text area" size="medium" />
|
|
172
|
+
<TextArea label="Large text area" size="large" />
|
|
173
|
+
</div>
|
|
174
|
+
);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export default Component;
|
|
178
|
+
```
|