@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,652 @@
|
|
|
1
|
+
# SideNavigation
|
|
2
|
+
|
|
3
|
+
Import: `import { SideNavigation } from '@neo4j-ndl/react'`
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### SideNavigation
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Required | Default | Description |
|
|
10
|
+
|------|------|----------|---------|-------------|
|
|
11
|
+
| `ariaLabel` | `string` | ✅ | | Aria label for the side navigation. Needed for menubar accessibility. |
|
|
12
|
+
| `children` | `ReactNode` | | | Content displayed inside the side navigation |
|
|
13
|
+
| `expandedWidth` | `Width<string \| number>` | | | Width used when expanded. Accepts any valid CSS width value or a number |
|
|
14
|
+
| `isExpanded` | `boolean` | | `false` | Whether the side navigation is expanded |
|
|
15
|
+
| `onPinButtonClick` | `(() => void)` | | | Callback function triggered when the pin button is clicked |
|
|
16
|
+
| `ref` | `Ref<HTMLDivElement>` | | | A ref to apply to the root element. |
|
|
17
|
+
| `shouldOverlayOnInteraction` | `boolean` | | `true` | Whether the side navigation expands on hover/focus when not pinned or compact |
|
|
18
|
+
|
|
19
|
+
### SideNavigation.CategoryHeader
|
|
20
|
+
|
|
21
|
+
| Prop | Type | Required | Default | Description |
|
|
22
|
+
|------|------|----------|---------|-------------|
|
|
23
|
+
| `children` | `ReactNode` | | | Content displayed inside the side navigation category header |
|
|
24
|
+
| `ref` | `Ref<HTMLLIElement>` | | | A ref to apply to the root element. |
|
|
25
|
+
|
|
26
|
+
### SideNavigation.CategoryItem
|
|
27
|
+
|
|
28
|
+
| Prop | Type | Required | Default | Description |
|
|
29
|
+
|------|------|----------|---------|-------------|
|
|
30
|
+
| `badge` | `ItemBadgeProps` | | | Badge displayed inside the side navigation item. Represented by an object with a number and a type (e.g., 'info', 'warning', 'danger'). |
|
|
31
|
+
| `children` | `ReactNode` | | | Content displayed inside the submenu popover. Typically a list of `SideNavigation.NavItem`. |
|
|
32
|
+
| `icon` | `ReactNode` | | | Icon displayed inside the side navigation item |
|
|
33
|
+
| `isActive` | `boolean` | | | Whether the side navigation item is selected |
|
|
34
|
+
| `isMenuOpen` | `boolean` | | `false` | If true, the menu will be open. Otherwise, the menu will open and close based on the user hovering the item. |
|
|
35
|
+
| `label` | `string` | | | Text label of the side navigation item |
|
|
36
|
+
| `ref` | `Ref<HTMLButtonElement>` | | | A ref to apply to the root element. |
|
|
37
|
+
|
|
38
|
+
### SideNavigation.Divider
|
|
39
|
+
|
|
40
|
+
_No props documented._
|
|
41
|
+
### SideNavigation.ItemBadge
|
|
42
|
+
|
|
43
|
+
| Prop | Type | Required | Default | Description |
|
|
44
|
+
|------|------|----------|---------|-------------|
|
|
45
|
+
| `number` | `number` | ✅ | | Number displayed inside the side navigation item badge |
|
|
46
|
+
| `ref` | `Ref<HTMLSpanElement>` | | | A ref to apply to the root element. |
|
|
47
|
+
| `type` | `'danger' \| 'info' \| 'warning'` | ✅ | | Type of the side navigation item badge |
|
|
48
|
+
|
|
49
|
+
### SideNavigation.ListItem
|
|
50
|
+
|
|
51
|
+
| Prop | Type | Required | Default | Description |
|
|
52
|
+
|------|------|----------|---------|-------------|
|
|
53
|
+
| `children` | `ReactNode` | | | Content displayed inside the side navigation list item |
|
|
54
|
+
| `ref` | `Ref<HTMLLIElement>` | | | A ref to apply to the root element. |
|
|
55
|
+
|
|
56
|
+
### SideNavigation.NavItem
|
|
57
|
+
|
|
58
|
+
| Prop | Type | Required | Default | Description |
|
|
59
|
+
|------|------|----------|---------|-------------|
|
|
60
|
+
| `as` | `("button" & ElementType<any, keyof IntrinsicElements>) \| ("symbol" & ElementType<any, keyof IntrinsicElements>) \| ... 177 more ... \| (FunctionComponent<...> & ElementType<...>)` | | | An override of the default HTML tag of the root of the component. Can also be another React component. What HTML element to render the root element as. |
|
|
61
|
+
| `badge` | `ItemBadgeProps` | | | Badge displayed inside the side navigation item. Represented by an object with a number and a type (e.g., 'info', 'warning', 'danger'). |
|
|
62
|
+
| `href` | `string` | | | The href of the link. Only applicable if `as` is `'a'`. |
|
|
63
|
+
| `icon` | `ReactNode` | | | Icon displayed inside the side navigation item |
|
|
64
|
+
| `isActive` | `boolean` | | | Whether the side navigation item is selected |
|
|
65
|
+
| `label` | `string` | | | Text label of the side navigation item |
|
|
66
|
+
| `onClick` | `MouseEventHandler<HTMLButtonElement>` | | | Event handler for when the button is clicked. Only applicable if `as` is `'button'`. |
|
|
67
|
+
| `ref` | `any` | | | A ref to apply to the root element. |
|
|
68
|
+
| `target` | `HTMLAttributeAnchorTarget` | | | The target of the link. Only applicable if `as` is `'a'`. |
|
|
69
|
+
| `trailingElement` | `ReactNode` | | | Element displayed on the leading side of the side navigation item (e.g., counter) |
|
|
70
|
+
|
|
71
|
+
## Examples
|
|
72
|
+
|
|
73
|
+
### Side Nav Badges
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
77
|
+
|
|
78
|
+
import { SideNavigation, Typography } from '@neo4j-ndl/react';
|
|
79
|
+
import {
|
|
80
|
+
CodeBracketIconOutline,
|
|
81
|
+
HomeIconOutline,
|
|
82
|
+
MagnifyingGlassIconOutline,
|
|
83
|
+
ServerIconOutline,
|
|
84
|
+
WrenchScrewdriverIconOutline,
|
|
85
|
+
} from '@neo4j-ndl/react/icons';
|
|
86
|
+
import { useState } from 'react';
|
|
87
|
+
|
|
88
|
+
const Component = () => {
|
|
89
|
+
const [active, setActive] = useState<string | null>(null);
|
|
90
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<div className="n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-bg-neutral-bg-default">
|
|
94
|
+
<SideNavigation
|
|
95
|
+
ariaLabel="Main side navigation"
|
|
96
|
+
isExpanded={isExpanded}
|
|
97
|
+
shouldOverlayOnInteraction={true}
|
|
98
|
+
onPinButtonClick={() => setIsExpanded(!isExpanded)}
|
|
99
|
+
>
|
|
100
|
+
<SideNavigation.ListItem>
|
|
101
|
+
<SideNavigation.NavItem
|
|
102
|
+
icon={<HomeIconOutline />}
|
|
103
|
+
label="Info Badge"
|
|
104
|
+
isActive={active === 'nav-item-1'}
|
|
105
|
+
onClick={() => setActive('nav-item-1')}
|
|
106
|
+
badge={{
|
|
107
|
+
number: 1,
|
|
108
|
+
type: 'info',
|
|
109
|
+
}}
|
|
110
|
+
/>
|
|
111
|
+
</SideNavigation.ListItem>
|
|
112
|
+
<SideNavigation.ListItem>
|
|
113
|
+
<SideNavigation.NavItem
|
|
114
|
+
icon={<CodeBracketIconOutline />}
|
|
115
|
+
label="Warning Badge"
|
|
116
|
+
isActive={active === 'nav-item-2'}
|
|
117
|
+
onClick={() => setActive('nav-item-2')}
|
|
118
|
+
badge={{
|
|
119
|
+
number: 1,
|
|
120
|
+
type: 'warning',
|
|
121
|
+
}}
|
|
122
|
+
/>
|
|
123
|
+
</SideNavigation.ListItem>
|
|
124
|
+
<SideNavigation.ListItem>
|
|
125
|
+
<SideNavigation.NavItem
|
|
126
|
+
icon={<ServerIconOutline />}
|
|
127
|
+
label="Critical Badge"
|
|
128
|
+
isActive={active === 'nav-item-3'}
|
|
129
|
+
onClick={() => setActive('nav-item-3')}
|
|
130
|
+
badge={{
|
|
131
|
+
number: 1,
|
|
132
|
+
type: 'danger',
|
|
133
|
+
}}
|
|
134
|
+
/>
|
|
135
|
+
</SideNavigation.ListItem>
|
|
136
|
+
<SideNavigation.Divider />
|
|
137
|
+
<SideNavigation.ListItem>
|
|
138
|
+
<SideNavigation.CategoryItem
|
|
139
|
+
icon={<WrenchScrewdriverIconOutline />}
|
|
140
|
+
label="Category Item"
|
|
141
|
+
isActive={['nav-item-4', 'nav-item-5', 'nav-item-6'].includes(
|
|
142
|
+
active ?? '',
|
|
143
|
+
)}
|
|
144
|
+
badge={{
|
|
145
|
+
number: 3,
|
|
146
|
+
type: 'danger',
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
149
|
+
<SideNavigation.ListItem>
|
|
150
|
+
<SideNavigation.NavItem
|
|
151
|
+
icon={<MagnifyingGlassIconOutline />}
|
|
152
|
+
label="Info Badge"
|
|
153
|
+
isActive={active === 'nav-item-4'}
|
|
154
|
+
onClick={() => setActive('nav-item-4')}
|
|
155
|
+
badge={{
|
|
156
|
+
number: 1,
|
|
157
|
+
type: 'info',
|
|
158
|
+
}}
|
|
159
|
+
/>
|
|
160
|
+
</SideNavigation.ListItem>
|
|
161
|
+
<SideNavigation.ListItem>
|
|
162
|
+
<SideNavigation.NavItem
|
|
163
|
+
icon={<MagnifyingGlassIconOutline />}
|
|
164
|
+
label="Warning Badge"
|
|
165
|
+
isActive={active === 'nav-item-5'}
|
|
166
|
+
onClick={() => setActive('nav-item-5')}
|
|
167
|
+
badge={{
|
|
168
|
+
number: 1,
|
|
169
|
+
type: 'warning',
|
|
170
|
+
}}
|
|
171
|
+
/>
|
|
172
|
+
</SideNavigation.ListItem>
|
|
173
|
+
<SideNavigation.ListItem>
|
|
174
|
+
<SideNavigation.NavItem
|
|
175
|
+
icon={<MagnifyingGlassIconOutline />}
|
|
176
|
+
label="Critical Badge"
|
|
177
|
+
isActive={active === 'nav-item-6'}
|
|
178
|
+
onClick={() => setActive('nav-item-6')}
|
|
179
|
+
badge={{
|
|
180
|
+
number: 1,
|
|
181
|
+
type: 'danger',
|
|
182
|
+
}}
|
|
183
|
+
/>
|
|
184
|
+
</SideNavigation.ListItem>
|
|
185
|
+
</SideNavigation.CategoryItem>
|
|
186
|
+
</SideNavigation.ListItem>
|
|
187
|
+
</SideNavigation>
|
|
188
|
+
<div className="n-h-full n-w-full">
|
|
189
|
+
<div className="n-flex n-flex-col n-p-8 n-w-full n-max-w-[1024px] n-mx-auto">
|
|
190
|
+
<div className="n-flex n-flex-col n-gap-token-8 n-bg-neutral-bg-weak n-p-token-32 n-rounded-lg n-items-center n-justify-center">
|
|
191
|
+
<Typography variant="title-4">Side Nav with Badges</Typography>
|
|
192
|
+
<Typography variant="body-medium">
|
|
193
|
+
Badges can be used to indicate that there are actions that need
|
|
194
|
+
attention from the user on the specific page. The badge can have
|
|
195
|
+
three different types of severity:
|
|
196
|
+
<b className="n-text-primary-text"> info</b>,
|
|
197
|
+
<b className="n-text-warning-text"> warning</b> and
|
|
198
|
+
<b className="n-text-danger-text"> danger</b>.
|
|
199
|
+
<br />
|
|
200
|
+
<br />
|
|
201
|
+
The badge on a <b>CategoryItem</b> should be the type of the
|
|
202
|
+
highest priority badge of the items in the category. The number
|
|
203
|
+
should be the total number of badges in the category.
|
|
204
|
+
</Typography>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
</div>
|
|
209
|
+
);
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
export default Component;
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Side Nav Compact
|
|
216
|
+
|
|
217
|
+
```tsx
|
|
218
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
219
|
+
|
|
220
|
+
import { SideNavigation, Typography } from '@neo4j-ndl/react';
|
|
221
|
+
import {
|
|
222
|
+
AcademicCapIconOutline,
|
|
223
|
+
ChartBarIconOutline,
|
|
224
|
+
CodeBracketIconOutline,
|
|
225
|
+
Cog6ToothIconOutline,
|
|
226
|
+
HomeIconOutline,
|
|
227
|
+
MagnifyingGlassIconOutline,
|
|
228
|
+
ServerIconOutline,
|
|
229
|
+
WrenchScrewdriverIconOutline,
|
|
230
|
+
} from '@neo4j-ndl/react/icons';
|
|
231
|
+
import { useState } from 'react';
|
|
232
|
+
|
|
233
|
+
const Component = () => {
|
|
234
|
+
const [active, setActive] = useState<string | null>(null);
|
|
235
|
+
|
|
236
|
+
return (
|
|
237
|
+
<div className="n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-bg-neutral-bg-default">
|
|
238
|
+
<SideNavigation
|
|
239
|
+
isExpanded={false}
|
|
240
|
+
shouldOverlayOnInteraction={false}
|
|
241
|
+
ariaLabel="Main side navigation"
|
|
242
|
+
>
|
|
243
|
+
<SideNavigation.ListItem>
|
|
244
|
+
<SideNavigation.NavItem
|
|
245
|
+
icon={<HomeIconOutline />}
|
|
246
|
+
label="Nav Item"
|
|
247
|
+
isActive={active === 'nav-item-1'}
|
|
248
|
+
onClick={() => setActive('nav-item-1')}
|
|
249
|
+
/>
|
|
250
|
+
</SideNavigation.ListItem>
|
|
251
|
+
<SideNavigation.ListItem>
|
|
252
|
+
<SideNavigation.NavItem
|
|
253
|
+
icon={<CodeBracketIconOutline />}
|
|
254
|
+
label="Nav Item"
|
|
255
|
+
isActive={active === 'nav-item-2'}
|
|
256
|
+
onClick={() => setActive('nav-item-2')}
|
|
257
|
+
/>
|
|
258
|
+
</SideNavigation.ListItem>
|
|
259
|
+
<SideNavigation.Divider />
|
|
260
|
+
<SideNavigation.ListItem>
|
|
261
|
+
<SideNavigation.NavItem
|
|
262
|
+
icon={<ServerIconOutline />}
|
|
263
|
+
label="Nav Item"
|
|
264
|
+
isActive={active === 'nav-item-3'}
|
|
265
|
+
onClick={() => setActive('nav-item-3')}
|
|
266
|
+
/>
|
|
267
|
+
</SideNavigation.ListItem>
|
|
268
|
+
<SideNavigation.ListItem>
|
|
269
|
+
<SideNavigation.CategoryItem
|
|
270
|
+
icon={<WrenchScrewdriverIconOutline />}
|
|
271
|
+
label="Category Item"
|
|
272
|
+
isActive={['nav-item-4', 'nav-item-5'].includes(active ?? '')}
|
|
273
|
+
>
|
|
274
|
+
<SideNavigation.ListItem>
|
|
275
|
+
<SideNavigation.NavItem
|
|
276
|
+
icon={<MagnifyingGlassIconOutline />}
|
|
277
|
+
label="Nested Nav Item"
|
|
278
|
+
isActive={active === 'nav-item-4'}
|
|
279
|
+
onClick={() => setActive('nav-item-4')}
|
|
280
|
+
/>
|
|
281
|
+
</SideNavigation.ListItem>
|
|
282
|
+
<SideNavigation.ListItem>
|
|
283
|
+
<SideNavigation.NavItem
|
|
284
|
+
icon={<MagnifyingGlassIconOutline />}
|
|
285
|
+
label="Nested Nav Item"
|
|
286
|
+
isActive={active === 'nav-item-5'}
|
|
287
|
+
onClick={() => setActive('nav-item-5')}
|
|
288
|
+
/>
|
|
289
|
+
</SideNavigation.ListItem>
|
|
290
|
+
</SideNavigation.CategoryItem>
|
|
291
|
+
</SideNavigation.ListItem>
|
|
292
|
+
<SideNavigation.ListItem>
|
|
293
|
+
<SideNavigation.NavItem
|
|
294
|
+
icon={<ChartBarIconOutline />}
|
|
295
|
+
label="Nav Item"
|
|
296
|
+
isActive={active === 'nav-item-6'}
|
|
297
|
+
onClick={() => setActive('nav-item-6')}
|
|
298
|
+
/>
|
|
299
|
+
</SideNavigation.ListItem>
|
|
300
|
+
<SideNavigation.ListItem>
|
|
301
|
+
<SideNavigation.NavItem
|
|
302
|
+
icon={<Cog6ToothIconOutline />}
|
|
303
|
+
label="Nav Item"
|
|
304
|
+
isActive={active === 'nav-item-7'}
|
|
305
|
+
onClick={() => setActive('nav-item-7')}
|
|
306
|
+
/>
|
|
307
|
+
</SideNavigation.ListItem>
|
|
308
|
+
<SideNavigation.Divider />
|
|
309
|
+
<SideNavigation.ListItem>
|
|
310
|
+
<SideNavigation.NavItem
|
|
311
|
+
icon={<AcademicCapIconOutline />}
|
|
312
|
+
label="Nav Item"
|
|
313
|
+
isActive={active === 'nav-item-8'}
|
|
314
|
+
onClick={() => setActive('nav-item-8')}
|
|
315
|
+
/>
|
|
316
|
+
</SideNavigation.ListItem>
|
|
317
|
+
</SideNavigation>
|
|
318
|
+
<div className="n-h-full n-w-full">
|
|
319
|
+
<div className="n-flex n-flex-col n-p-8 n-w-full n-max-w-[1024px] n-mx-auto">
|
|
320
|
+
<div className="n-flex n-flex-col n-gap-token-8 n-bg-neutral-bg-weak n-p-token-32 n-rounded-lg n-items-center n-justify-center">
|
|
321
|
+
<Typography variant="title-4">Compact Side Nav</Typography>
|
|
322
|
+
<Typography variant="body-medium">
|
|
323
|
+
When using a compact side nav you must make sure to set a
|
|
324
|
+
<b> label</b> on the NavItems, as the label will be used for the
|
|
325
|
+
built in tooltip. It is also needed for screen readers to behave
|
|
326
|
+
as correctly.
|
|
327
|
+
</Typography>
|
|
328
|
+
</div>
|
|
329
|
+
</div>
|
|
330
|
+
</div>
|
|
331
|
+
</div>
|
|
332
|
+
);
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
export default Component;
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Side Nav Default
|
|
339
|
+
|
|
340
|
+
```tsx
|
|
341
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
342
|
+
|
|
343
|
+
import { SideNavigation, Typography } from '@neo4j-ndl/react';
|
|
344
|
+
import {
|
|
345
|
+
AcademicCapIconOutline,
|
|
346
|
+
ChartBarIconOutline,
|
|
347
|
+
CodeBracketIconOutline,
|
|
348
|
+
Cog6ToothIconOutline,
|
|
349
|
+
HomeIconOutline,
|
|
350
|
+
MagnifyingGlassIconOutline,
|
|
351
|
+
ServerIconOutline,
|
|
352
|
+
WrenchScrewdriverIconOutline,
|
|
353
|
+
} from '@neo4j-ndl/react/icons';
|
|
354
|
+
import { useState } from 'react';
|
|
355
|
+
|
|
356
|
+
const Component = () => {
|
|
357
|
+
const [active, setActive] = useState<string | null>(null);
|
|
358
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
359
|
+
|
|
360
|
+
return (
|
|
361
|
+
<div className="n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-bg-neutral-bg-default">
|
|
362
|
+
<SideNavigation
|
|
363
|
+
isExpanded={isExpanded}
|
|
364
|
+
shouldOverlayOnInteraction={true}
|
|
365
|
+
onPinButtonClick={() => setIsExpanded(!isExpanded)}
|
|
366
|
+
ariaLabel="Main side navigation"
|
|
367
|
+
>
|
|
368
|
+
<SideNavigation.CategoryHeader>
|
|
369
|
+
Example Category Header
|
|
370
|
+
</SideNavigation.CategoryHeader>
|
|
371
|
+
<SideNavigation.ListItem>
|
|
372
|
+
<SideNavigation.NavItem
|
|
373
|
+
icon={<HomeIconOutline />}
|
|
374
|
+
label="Nav Item"
|
|
375
|
+
isActive={active === 'nav-item-1'}
|
|
376
|
+
onClick={() => setActive('nav-item-1')}
|
|
377
|
+
/>
|
|
378
|
+
</SideNavigation.ListItem>
|
|
379
|
+
<SideNavigation.ListItem>
|
|
380
|
+
<SideNavigation.NavItem
|
|
381
|
+
icon={<CodeBracketIconOutline />}
|
|
382
|
+
label="Nav Item"
|
|
383
|
+
isActive={active === 'nav-item-2'}
|
|
384
|
+
onClick={() => setActive('nav-item-2')}
|
|
385
|
+
/>
|
|
386
|
+
</SideNavigation.ListItem>
|
|
387
|
+
<SideNavigation.Divider />
|
|
388
|
+
<SideNavigation.ListItem>
|
|
389
|
+
<SideNavigation.NavItem
|
|
390
|
+
icon={<ServerIconOutline />}
|
|
391
|
+
label="Nav Item"
|
|
392
|
+
isActive={active === 'nav-item-3'}
|
|
393
|
+
onClick={() => setActive('nav-item-3')}
|
|
394
|
+
/>
|
|
395
|
+
</SideNavigation.ListItem>
|
|
396
|
+
<SideNavigation.ListItem>
|
|
397
|
+
<SideNavigation.CategoryItem
|
|
398
|
+
icon={<WrenchScrewdriverIconOutline />}
|
|
399
|
+
label="Category Item"
|
|
400
|
+
isActive={['nav-item-4', 'nav-item-5'].includes(active ?? '')}
|
|
401
|
+
>
|
|
402
|
+
<SideNavigation.ListItem>
|
|
403
|
+
<SideNavigation.NavItem
|
|
404
|
+
icon={<MagnifyingGlassIconOutline />}
|
|
405
|
+
label="Nested Nav Item"
|
|
406
|
+
isActive={active === 'nav-item-4'}
|
|
407
|
+
onClick={() => setActive('nav-item-4')}
|
|
408
|
+
/>
|
|
409
|
+
</SideNavigation.ListItem>
|
|
410
|
+
<SideNavigation.ListItem>
|
|
411
|
+
<SideNavigation.NavItem
|
|
412
|
+
icon={<MagnifyingGlassIconOutline />}
|
|
413
|
+
label="Nested Nav Item"
|
|
414
|
+
isActive={active === 'nav-item-5'}
|
|
415
|
+
onClick={() => setActive('nav-item-5')}
|
|
416
|
+
/>
|
|
417
|
+
</SideNavigation.ListItem>
|
|
418
|
+
</SideNavigation.CategoryItem>
|
|
419
|
+
</SideNavigation.ListItem>
|
|
420
|
+
<SideNavigation.ListItem>
|
|
421
|
+
<SideNavigation.NavItem
|
|
422
|
+
icon={<ChartBarIconOutline />}
|
|
423
|
+
label="Nav Item"
|
|
424
|
+
isActive={active === 'nav-item-6'}
|
|
425
|
+
onClick={() => setActive('nav-item-6')}
|
|
426
|
+
/>
|
|
427
|
+
</SideNavigation.ListItem>
|
|
428
|
+
<SideNavigation.ListItem>
|
|
429
|
+
<SideNavigation.NavItem
|
|
430
|
+
icon={<Cog6ToothIconOutline />}
|
|
431
|
+
label="Nav Item"
|
|
432
|
+
isActive={active === 'nav-item-7'}
|
|
433
|
+
onClick={() => setActive('nav-item-7')}
|
|
434
|
+
/>
|
|
435
|
+
</SideNavigation.ListItem>
|
|
436
|
+
<SideNavigation.Divider />
|
|
437
|
+
<SideNavigation.ListItem>
|
|
438
|
+
<SideNavigation.NavItem
|
|
439
|
+
icon={<AcademicCapIconOutline />}
|
|
440
|
+
label="Nav Item"
|
|
441
|
+
isActive={active === 'nav-item-8'}
|
|
442
|
+
onClick={() => setActive('nav-item-8')}
|
|
443
|
+
/>
|
|
444
|
+
</SideNavigation.ListItem>
|
|
445
|
+
</SideNavigation>
|
|
446
|
+
|
|
447
|
+
<div className="n-h-full n-w-full">
|
|
448
|
+
<div className="n-flex n-flex-col n-p-8 n-w-full n-max-w-[1024px] n-mx-auto">
|
|
449
|
+
<div className="n-flex n-flex-col n-gap-token-8 n-bg-neutral-bg-weak n-p-token-32 n-rounded-lg n-items-center n-justify-center">
|
|
450
|
+
<Typography variant="title-4">Default Side Nav</Typography>
|
|
451
|
+
<Typography variant="body-medium">
|
|
452
|
+
This is the default behavior for a side nav. It expands on hover,
|
|
453
|
+
and can be pinned to stay expanded.
|
|
454
|
+
</Typography>
|
|
455
|
+
</div>
|
|
456
|
+
</div>
|
|
457
|
+
</div>
|
|
458
|
+
</div>
|
|
459
|
+
);
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
export default Component;
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
### Side Nav Secondary
|
|
466
|
+
|
|
467
|
+
```tsx
|
|
468
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
469
|
+
|
|
470
|
+
import { SideNavigation, Typography } from '@neo4j-ndl/react';
|
|
471
|
+
import {
|
|
472
|
+
AcademicCapIconOutline,
|
|
473
|
+
ChartBarIconOutline,
|
|
474
|
+
CodeBracketIconOutline,
|
|
475
|
+
Cog6ToothIconOutline,
|
|
476
|
+
HomeIconOutline,
|
|
477
|
+
MagnifyingGlassIconOutline,
|
|
478
|
+
ServerIconOutline,
|
|
479
|
+
WrenchScrewdriverIconOutline,
|
|
480
|
+
} from '@neo4j-ndl/react/icons';
|
|
481
|
+
import { useState } from 'react';
|
|
482
|
+
|
|
483
|
+
const Component = () => {
|
|
484
|
+
const [active, setActive] = useState<string>('nav-item-8');
|
|
485
|
+
const [secondaryActive, setSecondaryActive] = useState<string>('beginner');
|
|
486
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
487
|
+
|
|
488
|
+
return (
|
|
489
|
+
<div className="n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-bg-neutral-bg-default n-overflow-hidden">
|
|
490
|
+
<SideNavigation
|
|
491
|
+
isExpanded={isExpanded}
|
|
492
|
+
shouldOverlayOnInteraction={true}
|
|
493
|
+
onPinButtonClick={() => setIsExpanded(!isExpanded)}
|
|
494
|
+
ariaLabel="Main side navigation"
|
|
495
|
+
>
|
|
496
|
+
<SideNavigation.ListItem>
|
|
497
|
+
<SideNavigation.NavItem
|
|
498
|
+
icon={<HomeIconOutline />}
|
|
499
|
+
label="Nav Item"
|
|
500
|
+
isActive={active === 'nav-item-1'}
|
|
501
|
+
onClick={() => setActive('nav-item-1')}
|
|
502
|
+
/>
|
|
503
|
+
</SideNavigation.ListItem>
|
|
504
|
+
<SideNavigation.ListItem>
|
|
505
|
+
<SideNavigation.NavItem
|
|
506
|
+
icon={<CodeBracketIconOutline />}
|
|
507
|
+
label="Nav Item"
|
|
508
|
+
isActive={active === 'nav-item-2'}
|
|
509
|
+
onClick={() => setActive('nav-item-2')}
|
|
510
|
+
/>
|
|
511
|
+
</SideNavigation.ListItem>
|
|
512
|
+
<SideNavigation.Divider />
|
|
513
|
+
<SideNavigation.ListItem>
|
|
514
|
+
<SideNavigation.NavItem
|
|
515
|
+
icon={<ServerIconOutline />}
|
|
516
|
+
label="Nav Item"
|
|
517
|
+
isActive={active === 'nav-item-3'}
|
|
518
|
+
onClick={() => setActive('nav-item-3')}
|
|
519
|
+
/>
|
|
520
|
+
</SideNavigation.ListItem>
|
|
521
|
+
<SideNavigation.ListItem>
|
|
522
|
+
<SideNavigation.CategoryItem
|
|
523
|
+
icon={<WrenchScrewdriverIconOutline />}
|
|
524
|
+
label="Category Item"
|
|
525
|
+
isActive={['nav-item-4', 'nav-item-5'].includes(active)}
|
|
526
|
+
>
|
|
527
|
+
<SideNavigation.ListItem>
|
|
528
|
+
<SideNavigation.NavItem
|
|
529
|
+
icon={<MagnifyingGlassIconOutline />}
|
|
530
|
+
label="Nested Nav Item"
|
|
531
|
+
isActive={active === 'nav-item-4'}
|
|
532
|
+
onClick={() => setActive('nav-item-4')}
|
|
533
|
+
/>
|
|
534
|
+
</SideNavigation.ListItem>
|
|
535
|
+
<SideNavigation.ListItem>
|
|
536
|
+
<SideNavigation.NavItem
|
|
537
|
+
icon={<MagnifyingGlassIconOutline />}
|
|
538
|
+
label="Nested Nav Item"
|
|
539
|
+
isActive={active === 'nav-item-5'}
|
|
540
|
+
onClick={() => setActive('nav-item-5')}
|
|
541
|
+
/>
|
|
542
|
+
</SideNavigation.ListItem>
|
|
543
|
+
</SideNavigation.CategoryItem>
|
|
544
|
+
</SideNavigation.ListItem>
|
|
545
|
+
<SideNavigation.ListItem>
|
|
546
|
+
<SideNavigation.NavItem
|
|
547
|
+
icon={<ChartBarIconOutline />}
|
|
548
|
+
label="Nav Item"
|
|
549
|
+
isActive={active === 'nav-item-6'}
|
|
550
|
+
onClick={() => setActive('nav-item-6')}
|
|
551
|
+
/>
|
|
552
|
+
</SideNavigation.ListItem>
|
|
553
|
+
<SideNavigation.ListItem>
|
|
554
|
+
<SideNavigation.NavItem
|
|
555
|
+
icon={<Cog6ToothIconOutline />}
|
|
556
|
+
label="Nav Item"
|
|
557
|
+
isActive={active === 'nav-item-7'}
|
|
558
|
+
onClick={() => setActive('nav-item-7')}
|
|
559
|
+
/>
|
|
560
|
+
</SideNavigation.ListItem>
|
|
561
|
+
<SideNavigation.Divider />
|
|
562
|
+
<SideNavigation.ListItem>
|
|
563
|
+
<SideNavigation.NavItem
|
|
564
|
+
icon={<AcademicCapIconOutline />}
|
|
565
|
+
label="Nav Item"
|
|
566
|
+
isActive={active === 'nav-item-8'}
|
|
567
|
+
onClick={() => setActive('nav-item-8')}
|
|
568
|
+
/>
|
|
569
|
+
</SideNavigation.ListItem>
|
|
570
|
+
</SideNavigation>
|
|
571
|
+
<SideNavigation
|
|
572
|
+
isExpanded={true}
|
|
573
|
+
shouldOverlayOnInteraction={false}
|
|
574
|
+
expandedWidth={220}
|
|
575
|
+
ariaLabel="Secondary side navigation"
|
|
576
|
+
>
|
|
577
|
+
<SideNavigation.CategoryHeader>
|
|
578
|
+
Category Header
|
|
579
|
+
</SideNavigation.CategoryHeader>
|
|
580
|
+
<SideNavigation.ListItem>
|
|
581
|
+
<SideNavigation.NavItem
|
|
582
|
+
label="Secondary Nav Item"
|
|
583
|
+
isActive={secondaryActive === 'secondary-nav-item-1'}
|
|
584
|
+
onClick={() => setSecondaryActive('secondary-nav-item-1')}
|
|
585
|
+
/>
|
|
586
|
+
</SideNavigation.ListItem>
|
|
587
|
+
<SideNavigation.ListItem>
|
|
588
|
+
<SideNavigation.NavItem
|
|
589
|
+
label="Secondary Nav Item"
|
|
590
|
+
isActive={secondaryActive === 'secondary-nav-item-2'}
|
|
591
|
+
onClick={() => setSecondaryActive('secondary-nav-item-2')}
|
|
592
|
+
/>
|
|
593
|
+
</SideNavigation.ListItem>
|
|
594
|
+
<SideNavigation.ListItem>
|
|
595
|
+
<SideNavigation.NavItem
|
|
596
|
+
label="Secondary Nav Item"
|
|
597
|
+
isActive={secondaryActive === 'secondary-nav-item-3'}
|
|
598
|
+
onClick={() => setSecondaryActive('secondary-nav-item-3')}
|
|
599
|
+
/>
|
|
600
|
+
</SideNavigation.ListItem>
|
|
601
|
+
<SideNavigation.ListItem>
|
|
602
|
+
<SideNavigation.NavItem
|
|
603
|
+
label="Secondary Nav Item"
|
|
604
|
+
isActive={secondaryActive === 'secondary-nav-item-4'}
|
|
605
|
+
onClick={() => setSecondaryActive('secondary-nav-item-4')}
|
|
606
|
+
/>
|
|
607
|
+
</SideNavigation.ListItem>
|
|
608
|
+
<SideNavigation.ListItem>
|
|
609
|
+
<SideNavigation.NavItem
|
|
610
|
+
label="Secondary Nav Item"
|
|
611
|
+
isActive={secondaryActive === 'secondary-nav-item-5'}
|
|
612
|
+
onClick={() => setSecondaryActive('secondary-nav-item-5')}
|
|
613
|
+
/>
|
|
614
|
+
</SideNavigation.ListItem>
|
|
615
|
+
<SideNavigation.CategoryHeader>
|
|
616
|
+
Category Header
|
|
617
|
+
</SideNavigation.CategoryHeader>
|
|
618
|
+
<SideNavigation.ListItem>
|
|
619
|
+
<SideNavigation.NavItem
|
|
620
|
+
label="Secondary Nav Item"
|
|
621
|
+
icon={<MagnifyingGlassIconOutline />}
|
|
622
|
+
isActive={secondaryActive === 'secondary-nav-item-6'}
|
|
623
|
+
onClick={() => setSecondaryActive('secondary-nav-item-6')}
|
|
624
|
+
/>
|
|
625
|
+
</SideNavigation.ListItem>
|
|
626
|
+
<SideNavigation.ListItem>
|
|
627
|
+
<SideNavigation.NavItem
|
|
628
|
+
label="Secondary Nav Item"
|
|
629
|
+
icon={<MagnifyingGlassIconOutline />}
|
|
630
|
+
isActive={secondaryActive === 'secondary-nav-item-7'}
|
|
631
|
+
onClick={() => setSecondaryActive('secondary-nav-item-7')}
|
|
632
|
+
/>
|
|
633
|
+
</SideNavigation.ListItem>
|
|
634
|
+
</SideNavigation>
|
|
635
|
+
<div className="n-h-full n-w-full">
|
|
636
|
+
<div className="n-flex n-flex-col n-p-8 n-w-full n-max-w-[1024px] n-mx-auto">
|
|
637
|
+
<div className="n-flex n-flex-col n-gap-token-8 n-bg-neutral-bg-weak n-p-token-32 n-rounded-lg n-items-center n-justify-center">
|
|
638
|
+
<Typography variant="title-4">Secondary Side Nav</Typography>
|
|
639
|
+
<Typography variant="body-medium">
|
|
640
|
+
If a page requires its own navigation, you can use a secondary
|
|
641
|
+
side nav. The secondary side nav is always expanded and does not
|
|
642
|
+
have a pin button.
|
|
643
|
+
</Typography>
|
|
644
|
+
</div>
|
|
645
|
+
</div>
|
|
646
|
+
</div>
|
|
647
|
+
</div>
|
|
648
|
+
);
|
|
649
|
+
};
|
|
650
|
+
|
|
651
|
+
export default Component;
|
|
652
|
+
```
|