@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,225 @@
|
|
|
1
|
+
# Banner
|
|
2
|
+
|
|
3
|
+
Import: `import { Banner } from '@neo4j-ndl/react'`
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### Banner
|
|
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` | | | Content to be shown in the banner. |
|
|
13
|
+
| `hasIcon` | `boolean` | | `false` | Shows a status icon. The icon is based on the value of the `variant` prop |
|
|
14
|
+
| `isAlert` | `boolean` | | `false` | Sets the role to alert |
|
|
15
|
+
| `isCloseable` | `boolean` | | `false` | If the banner is closeable. Renders an icon button in the top right corner |
|
|
16
|
+
| `onClose` | `((e?: MouseEvent<HTMLElement, MouseEvent> \| KeyboardEvent<HTMLElement>) => void)` | | | Event handler for when the close icon is clicked |
|
|
17
|
+
| `ref` | `any` | | | A ref to apply to the root element. |
|
|
18
|
+
| `usage` | `'global' \| 'inline'` | | `inline` | How the banner is used. |
|
|
19
|
+
| `variant` | `'danger' \| 'info' \| 'neutral' \| 'success' \| 'warning'` | | `info` | The variant of the banner |
|
|
20
|
+
|
|
21
|
+
### Banner.Actions
|
|
22
|
+
|
|
23
|
+
| Prop | Type | Required | Default | Description |
|
|
24
|
+
|------|------|----------|---------|-------------|
|
|
25
|
+
| `children` | `ReactNode` | ✅ | | |
|
|
26
|
+
| `ref` | `Ref<HTMLDivElement>` | | | A ref to apply to the root element. |
|
|
27
|
+
|
|
28
|
+
### Banner.Description
|
|
29
|
+
|
|
30
|
+
| Prop | Type | Required | Default | Description |
|
|
31
|
+
|------|------|----------|---------|-------------|
|
|
32
|
+
| `children` | `ReactNode` | ✅ | | |
|
|
33
|
+
| `ref` | `Ref<HTMLDivElement>` | | | A ref to apply to the root element. |
|
|
34
|
+
|
|
35
|
+
### Banner.Header
|
|
36
|
+
|
|
37
|
+
| Prop | Type | Required | Default | Description |
|
|
38
|
+
|------|------|----------|---------|-------------|
|
|
39
|
+
| `children` | `ReactNode` | ✅ | | |
|
|
40
|
+
| `ref` | `Ref<HTMLSpanElement>` | | | A ref to apply to the root element. |
|
|
41
|
+
|
|
42
|
+
## Accessibility
|
|
43
|
+
|
|
44
|
+
## Implementation guidelines
|
|
45
|
+
|
|
46
|
+
The `isAlert` prop must be set to `true` for the banner to be given an alert role, which is used by screen readers. If this role is not wanted, make sure to set the prop to `false`.
|
|
47
|
+
|
|
48
|
+
## Examples
|
|
49
|
+
|
|
50
|
+
### Closeable
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
54
|
+
|
|
55
|
+
import { Banner } from '@neo4j-ndl/react';
|
|
56
|
+
|
|
57
|
+
const Component = () => {
|
|
58
|
+
const title = 'Banner title';
|
|
59
|
+
return (
|
|
60
|
+
<Banner
|
|
61
|
+
isCloseable={true}
|
|
62
|
+
onClose={() => alert('Banner component close icon clicked')}
|
|
63
|
+
>
|
|
64
|
+
<Banner.Header>{title}</Banner.Header>
|
|
65
|
+
<Banner.Description>Banner description</Banner.Description>
|
|
66
|
+
</Banner>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export default Component;
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Global
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
77
|
+
|
|
78
|
+
import { Banner } from '@neo4j-ndl/react';
|
|
79
|
+
|
|
80
|
+
const Component = () => {
|
|
81
|
+
const title = 'Banner title';
|
|
82
|
+
return (
|
|
83
|
+
<Banner usage="global">
|
|
84
|
+
<Banner.Header>{title}</Banner.Header>
|
|
85
|
+
<Banner.Description>Banner description</Banner.Description>
|
|
86
|
+
</Banner>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export default Component;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Variants
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
97
|
+
|
|
98
|
+
import { Banner } from '@neo4j-ndl/react';
|
|
99
|
+
|
|
100
|
+
const Component = () => {
|
|
101
|
+
return (
|
|
102
|
+
<div className="n-flex n-flex-col n-gap-token-8">
|
|
103
|
+
<Banner variant="info">
|
|
104
|
+
<Banner.Header>Info</Banner.Header>
|
|
105
|
+
<Banner.Description>This is a banner of type info.</Banner.Description>
|
|
106
|
+
</Banner>
|
|
107
|
+
<Banner variant="success">
|
|
108
|
+
<Banner.Header>Success</Banner.Header>
|
|
109
|
+
<Banner.Description>
|
|
110
|
+
This is a banner of type success.
|
|
111
|
+
</Banner.Description>
|
|
112
|
+
</Banner>
|
|
113
|
+
<Banner variant="warning">
|
|
114
|
+
<Banner.Header>Warning</Banner.Header>
|
|
115
|
+
<Banner.Description>
|
|
116
|
+
This is a banner of type warning.
|
|
117
|
+
</Banner.Description>
|
|
118
|
+
</Banner>
|
|
119
|
+
<Banner variant="danger">
|
|
120
|
+
<Banner.Header>Danger</Banner.Header>
|
|
121
|
+
<Banner.Description>
|
|
122
|
+
This is a banner of type danger.
|
|
123
|
+
</Banner.Description>
|
|
124
|
+
</Banner>
|
|
125
|
+
<Banner variant="neutral">
|
|
126
|
+
<Banner.Header>Neutral</Banner.Header>
|
|
127
|
+
<Banner.Description>
|
|
128
|
+
This is a banner of type neutral.
|
|
129
|
+
</Banner.Description>
|
|
130
|
+
</Banner>
|
|
131
|
+
</div>
|
|
132
|
+
);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export default Component;
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### With Actions
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
142
|
+
|
|
143
|
+
import { Banner, OutlinedButton, TextButton } from '@neo4j-ndl/react';
|
|
144
|
+
|
|
145
|
+
const Component = () => {
|
|
146
|
+
return (
|
|
147
|
+
<Banner hasIcon={true}>
|
|
148
|
+
<Banner.Header>Banner title</Banner.Header>
|
|
149
|
+
<Banner.Description>Banner description</Banner.Description>
|
|
150
|
+
<Banner.Actions>
|
|
151
|
+
<OutlinedButton>Primary action</OutlinedButton>
|
|
152
|
+
<TextButton>Secondary action</TextButton>
|
|
153
|
+
</Banner.Actions>
|
|
154
|
+
</Banner>
|
|
155
|
+
);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export default Component;
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### With Icons
|
|
162
|
+
|
|
163
|
+
```tsx
|
|
164
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
165
|
+
|
|
166
|
+
import { Banner } from '@neo4j-ndl/react';
|
|
167
|
+
|
|
168
|
+
const Component = () => {
|
|
169
|
+
return (
|
|
170
|
+
<div className="n-flex n-flex-col n-gap-token-8">
|
|
171
|
+
<Banner variant="info" hasIcon={true}>
|
|
172
|
+
<Banner.Header>Info</Banner.Header>
|
|
173
|
+
<Banner.Description>This is a banner of type info.</Banner.Description>
|
|
174
|
+
</Banner>
|
|
175
|
+
<Banner variant="success" hasIcon={true}>
|
|
176
|
+
<Banner.Header>Success</Banner.Header>
|
|
177
|
+
<Banner.Description>
|
|
178
|
+
This is a banner of type success.
|
|
179
|
+
</Banner.Description>
|
|
180
|
+
</Banner>
|
|
181
|
+
<Banner variant="warning" hasIcon={true}>
|
|
182
|
+
<Banner.Header>Warning</Banner.Header>
|
|
183
|
+
<Banner.Description>
|
|
184
|
+
This is a banner of type warning.
|
|
185
|
+
</Banner.Description>
|
|
186
|
+
</Banner>
|
|
187
|
+
<Banner variant="danger" hasIcon={true}>
|
|
188
|
+
<Banner.Header>Danger</Banner.Header>
|
|
189
|
+
<Banner.Description>
|
|
190
|
+
This is a banner of type danger.
|
|
191
|
+
</Banner.Description>
|
|
192
|
+
</Banner>
|
|
193
|
+
<Banner variant="neutral" hasIcon={true}>
|
|
194
|
+
<Banner.Header>Neutral</Banner.Header>
|
|
195
|
+
<Banner.Description>
|
|
196
|
+
This is a banner of type neutral.
|
|
197
|
+
</Banner.Description>
|
|
198
|
+
</Banner>
|
|
199
|
+
</div>
|
|
200
|
+
);
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export default Component;
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Without Title
|
|
207
|
+
|
|
208
|
+
```tsx
|
|
209
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
210
|
+
|
|
211
|
+
import { Banner, OutlinedButton } from '@neo4j-ndl/react';
|
|
212
|
+
|
|
213
|
+
const Component = () => {
|
|
214
|
+
return (
|
|
215
|
+
<Banner>
|
|
216
|
+
<Banner.Description>A banner with only description</Banner.Description>
|
|
217
|
+
<Banner.Actions>
|
|
218
|
+
<OutlinedButton>Action</OutlinedButton>
|
|
219
|
+
</Banner.Actions>
|
|
220
|
+
</Banner>
|
|
221
|
+
);
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export default Component;
|
|
225
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Box
|
|
2
|
+
|
|
3
|
+
Import: `import { Box } from '@neo4j-ndl/react'`
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### Box
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Required | Default | Description |
|
|
10
|
+
|------|------|----------|---------|-------------|
|
|
11
|
+
| `as` | `ElementType<any, keyof IntrinsicElements>` | | `'div' as T` | An override of the default HTML tag of the root of the component. Can also be another React component. |
|
|
12
|
+
| `borderRadius` | `'2xl' \| '3xl' \| 'full' \| 'lg' \| 'md' \| 'none' \| 'sm' \| 'xl'` | | `undefined` | |
|
|
13
|
+
| `children` | `ReactNode` | | | |
|
|
14
|
+
| `padding` | `'12' \| '16' \| '2' \| '20' \| '24' \| '32' \| '4' \| '48' \| '6' \| '64' \| '8'` | | `tokens.space['4']` | |
|
|
15
|
+
| `paddingBlockEnd` | `'12' \| '16' \| '2' \| '20' \| '24' \| '32' \| '4' \| '48' \| '6' \| '64' \| '8'` | | `undefined` | |
|
|
16
|
+
| `paddingBlockStart` | `'12' \| '16' \| '2' \| '20' \| '24' \| '32' \| '4' \| '48' \| '6' \| '64' \| '8'` | | `undefined` | |
|
|
17
|
+
| `paddingInline` | `'12' \| '16' \| '2' \| '20' \| '24' \| '32' \| '4' \| '48' \| '6' \| '64' \| '8'` | | `undefined` | |
|
|
18
|
+
| `paddingInlineEnd` | `'12' \| '16' \| '2' \| '20' \| '24' \| '32' \| '4' \| '48' \| '6' \| '64' \| '8'` | | `undefined` | |
|
|
19
|
+
| `paddingInlineStart` | `'12' \| '16' \| '2' \| '20' \| '24' \| '32' \| '4' \| '48' \| '6' \| '64' \| '8'` | | `undefined` | |
|
|
20
|
+
| `ref` | `any` | | | A ref to apply to the root element. |
|
|
21
|
+
|
|
22
|
+
## Examples
|
|
23
|
+
|
|
24
|
+
### Default
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
28
|
+
|
|
29
|
+
import { Box } from '@neo4j-ndl/react';
|
|
30
|
+
import type React from 'react';
|
|
31
|
+
|
|
32
|
+
type BoxProps = React.ComponentProps<typeof Box>;
|
|
33
|
+
|
|
34
|
+
const BoxDefault = (args: BoxProps) => <Box {...args}>{args.children}</Box>;
|
|
35
|
+
|
|
36
|
+
BoxDefault.displayName = 'BoxDefault';
|
|
37
|
+
|
|
38
|
+
export default BoxDefault;
|
|
39
|
+
```
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# Breadcrumbs
|
|
2
|
+
|
|
3
|
+
Import: `import { Breadcrumbs } from '@neo4j-ndl/react'`
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### Breadcrumbs
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Required | Default | Description |
|
|
10
|
+
|------|------|----------|---------|-------------|
|
|
11
|
+
| `children` | `ReactNode` | | | Content to be rendered. Should only be `Breadcrumbs.Item`. |
|
|
12
|
+
| `ref` | `Ref<HTMLElement>` | | | A ref to apply to the root element. |
|
|
13
|
+
| `shouldWrap` | `boolean` | | `true` | Additional classnames. |
|
|
14
|
+
|
|
15
|
+
### Breadcrumbs.Button
|
|
16
|
+
|
|
17
|
+
| Prop | Type | Required | Default | Description |
|
|
18
|
+
|------|------|----------|---------|-------------|
|
|
19
|
+
| `as` | `("button" & ElementType<any, keyof IntrinsicElements>) \| ("a" & 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. |
|
|
20
|
+
| `children` | `ReactNode` | | | Content to be rendered. |
|
|
21
|
+
| `href` | `string` | ✅ | | The href of the link. Only applicable if `as` is `'a'`. |
|
|
22
|
+
| `leadingElement` | `ReactNode` | | | Leading element to be rendered. |
|
|
23
|
+
| `onClick` | `(event: MouseEvent<HTMLButtonElement, MouseEvent>) => void` | | | Event handler for when the button is clicked. Only applicable if `as` is `'button'`. |
|
|
24
|
+
| `ref` | `any` | | | A ref to apply to the root element. |
|
|
25
|
+
| `target` | `HTMLAttributeAnchorTarget` | | | The target of the link. Only applicable if `as` is `'a'`. |
|
|
26
|
+
| `trailingElement` | `ReactNode` | | | Trailing element to be rendered. |
|
|
27
|
+
|
|
28
|
+
### Breadcrumbs.Item
|
|
29
|
+
|
|
30
|
+
| Prop | Type | Required | Default | Description |
|
|
31
|
+
|------|------|----------|---------|-------------|
|
|
32
|
+
| `children` | `ReactNode` | | | Content to be rendered. Should be either `Breadcrumbs.Link`, `Breadcrumbs.Button` or `Breadcrumbs.SelectButton`. |
|
|
33
|
+
| `ref` | `Ref<HTMLLIElement>` | | | A ref to apply to the root element. |
|
|
34
|
+
|
|
35
|
+
### Breadcrumbs.Link
|
|
36
|
+
|
|
37
|
+
| Prop | Type | Required | Default | Description |
|
|
38
|
+
|------|------|----------|---------|-------------|
|
|
39
|
+
| `ariaCurrent` | `boolean \| "time" \| "false" \| "true" \| "page" \| "step" \| "location" \| "date"` | | `false` | Whether the link is the current item. Use `'page'` if it indicates the current page and `'step'` for steps (in a multi-step wizard for example). @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current |
|
|
40
|
+
| `as` | `("button" & ElementType<any, keyof IntrinsicElements>) \| ("a" & 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. |
|
|
41
|
+
| `children` | `ReactNode` | | | Content to be rendered. |
|
|
42
|
+
| `href` | `string` | ✅ | | The href of the link. Only applicable if `as` is `'a'`. |
|
|
43
|
+
| `onClick` | `(event: MouseEvent<HTMLButtonElement, MouseEvent>) => void` | | | Event handler for when the button is clicked. Only applicable if `as` is `'button'`. |
|
|
44
|
+
| `ref` | `any` | | | A ref to apply to the root element. |
|
|
45
|
+
| `target` | `HTMLAttributeAnchorTarget` | | | The target of the link. Only applicable if `as` is `'a'`. |
|
|
46
|
+
|
|
47
|
+
### Breadcrumbs.SelectButton
|
|
48
|
+
|
|
49
|
+
| Prop | Type | Required | Default | Description |
|
|
50
|
+
|------|------|----------|---------|-------------|
|
|
51
|
+
| `ariaLabel` | `string` | ✅ | | Aria label needed for accessibility. |
|
|
52
|
+
| `children` | `ReactNode` | | | Content to be rendered. |
|
|
53
|
+
| `isActive` | `boolean` | | | Active - used when a connected menu is open |
|
|
54
|
+
| `onClick` | `(event: MouseEvent<HTMLButtonElement, MouseEvent>) => void` | | | Event handler for when the button is clicked. Should be used to open a `Menu`. |
|
|
55
|
+
| `ref` | `Ref<HTMLButtonElement>` | | | A ref to apply to the root element. |
|
|
56
|
+
|
|
57
|
+
## Accessibility
|
|
58
|
+
|
|
59
|
+
## Implementation guidelines
|
|
60
|
+
|
|
61
|
+
- The `Link` has a `ariaCurrent` prop that should be set on the breadcrumb that is representing the current step or page, to the corresponding value.
|
|
62
|
+
|
|
63
|
+
- The `Button` can be used with both icon + text, text only or icon only. If you only provide an icon, to create a custom home breadcrumb e.g., make sure to set the `aria-label` in the `htmlAttributes` prop.
|
|
64
|
+
|
|
65
|
+
- The `SelectButton` is essentially an icon button, and therefore has a prop `ariaLabel` that is required for accessibility.
|
|
66
|
+
|
|
67
|
+
## Examples
|
|
68
|
+
|
|
69
|
+
### Ellipses
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
73
|
+
|
|
74
|
+
import { Breadcrumbs, Menu } from '@neo4j-ndl/react';
|
|
75
|
+
import { useRef, useState } from 'react';
|
|
76
|
+
|
|
77
|
+
const Component = () => {
|
|
78
|
+
const menuRef = useRef<HTMLButtonElement>(null);
|
|
79
|
+
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<Breadcrumbs>
|
|
83
|
+
<Breadcrumbs.Item>
|
|
84
|
+
<Breadcrumbs.Link href="#">Home</Breadcrumbs.Link>
|
|
85
|
+
</Breadcrumbs.Item>
|
|
86
|
+
<Breadcrumbs.Item>
|
|
87
|
+
<Breadcrumbs.Link
|
|
88
|
+
ref={menuRef}
|
|
89
|
+
as="button"
|
|
90
|
+
onClick={() => setIsMenuOpen(!isMenuOpen)}
|
|
91
|
+
htmlAttributes={{
|
|
92
|
+
'aria-label': 'Open ellipsis menu',
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
95
|
+
...
|
|
96
|
+
<Menu
|
|
97
|
+
anchorRef={menuRef}
|
|
98
|
+
isOpen={isMenuOpen}
|
|
99
|
+
onClose={() => setIsMenuOpen(false)}
|
|
100
|
+
>
|
|
101
|
+
<Menu.Item title="Page 1" />
|
|
102
|
+
<Menu.Item title="Page 2" />
|
|
103
|
+
<Menu.Item title="Page 3" />
|
|
104
|
+
</Menu>
|
|
105
|
+
</Breadcrumbs.Link>
|
|
106
|
+
</Breadcrumbs.Item>
|
|
107
|
+
<Breadcrumbs.Item>
|
|
108
|
+
<Breadcrumbs.Link as="span" ariaCurrent="page">
|
|
109
|
+
Current page
|
|
110
|
+
</Breadcrumbs.Link>
|
|
111
|
+
</Breadcrumbs.Item>
|
|
112
|
+
</Breadcrumbs>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export default Component;
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Header
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
123
|
+
|
|
124
|
+
import { Breadcrumbs, Menu } from '@neo4j-ndl/react';
|
|
125
|
+
import {
|
|
126
|
+
BuildingOffice2IconOutline,
|
|
127
|
+
FolderIconOutline,
|
|
128
|
+
Neo4JIconColorIcon,
|
|
129
|
+
} from '@neo4j-ndl/react/icons';
|
|
130
|
+
import { useRef, useState } from 'react';
|
|
131
|
+
|
|
132
|
+
const Component = () => {
|
|
133
|
+
const [isOrganizationMenuOpen, setIsOrganizationMenuOpen] = useState(false);
|
|
134
|
+
const organizationMenuRef = useRef<HTMLButtonElement>(null);
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<Breadcrumbs shouldWrap={false}>
|
|
138
|
+
<Breadcrumbs.Item className="n-mr-token-8">
|
|
139
|
+
<button
|
|
140
|
+
type="button"
|
|
141
|
+
aria-label="Home"
|
|
142
|
+
className="n-rounded-sm focus-visible:n-outline-2 focus-visible:n-outline-offset-[3px] focus-visible:n-outline-primary-focus n-shrink-0"
|
|
143
|
+
>
|
|
144
|
+
<Neo4JIconColorIcon className="n-h-6 n-w-[26px]" />
|
|
145
|
+
</button>
|
|
146
|
+
</Breadcrumbs.Item>
|
|
147
|
+
<Breadcrumbs.Item>
|
|
148
|
+
<Breadcrumbs.Button leadingElement={<BuildingOffice2IconOutline />}>
|
|
149
|
+
Organization 1
|
|
150
|
+
</Breadcrumbs.Button>
|
|
151
|
+
<Breadcrumbs.SelectButton
|
|
152
|
+
ref={organizationMenuRef}
|
|
153
|
+
ariaLabel="Open organization menu"
|
|
154
|
+
onClick={() => {
|
|
155
|
+
setIsOrganizationMenuOpen((prev) => !prev);
|
|
156
|
+
}}
|
|
157
|
+
isActive={isOrganizationMenuOpen}
|
|
158
|
+
>
|
|
159
|
+
<Menu
|
|
160
|
+
anchorRef={organizationMenuRef}
|
|
161
|
+
isOpen={isOrganizationMenuOpen}
|
|
162
|
+
onClose={() => setIsOrganizationMenuOpen(false)}
|
|
163
|
+
>
|
|
164
|
+
<Menu.Group>
|
|
165
|
+
<Menu.RadioItem title="Organization 1" isChecked={true} />
|
|
166
|
+
<Menu.RadioItem title="Organization 2" isChecked={false} />
|
|
167
|
+
</Menu.Group>
|
|
168
|
+
<Menu.Divider />
|
|
169
|
+
<Menu.Group>
|
|
170
|
+
<Menu.Item title="All Organizations" />
|
|
171
|
+
</Menu.Group>
|
|
172
|
+
</Menu>
|
|
173
|
+
</Breadcrumbs.SelectButton>
|
|
174
|
+
</Breadcrumbs.Item>
|
|
175
|
+
<Breadcrumbs.Item>
|
|
176
|
+
<Breadcrumbs.Button leadingElement={<FolderIconOutline />}>
|
|
177
|
+
Project 1
|
|
178
|
+
</Breadcrumbs.Button>
|
|
179
|
+
<Breadcrumbs.SelectButton ariaLabel="Open project menu"></Breadcrumbs.SelectButton>
|
|
180
|
+
</Breadcrumbs.Item>
|
|
181
|
+
</Breadcrumbs>
|
|
182
|
+
);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export default Component;
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Pages
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
192
|
+
|
|
193
|
+
import { Breadcrumbs } from '@neo4j-ndl/react';
|
|
194
|
+
|
|
195
|
+
const Component = () => {
|
|
196
|
+
return (
|
|
197
|
+
<Breadcrumbs>
|
|
198
|
+
<Breadcrumbs.Item>
|
|
199
|
+
<Breadcrumbs.Link href="">Home</Breadcrumbs.Link>
|
|
200
|
+
</Breadcrumbs.Item>
|
|
201
|
+
<Breadcrumbs.Item>
|
|
202
|
+
<Breadcrumbs.Link href="">Page</Breadcrumbs.Link>
|
|
203
|
+
</Breadcrumbs.Item>
|
|
204
|
+
<Breadcrumbs.Item>
|
|
205
|
+
<Breadcrumbs.Link href="">Subpage</Breadcrumbs.Link>
|
|
206
|
+
</Breadcrumbs.Item>
|
|
207
|
+
<Breadcrumbs.Item>
|
|
208
|
+
<Breadcrumbs.Link href="" ariaCurrent="page">
|
|
209
|
+
Current page
|
|
210
|
+
</Breadcrumbs.Link>
|
|
211
|
+
</Breadcrumbs.Item>
|
|
212
|
+
</Breadcrumbs>
|
|
213
|
+
);
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export default Component;
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Steps
|
|
220
|
+
|
|
221
|
+
```tsx
|
|
222
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
223
|
+
|
|
224
|
+
import { Breadcrumbs } from '@neo4j-ndl/react';
|
|
225
|
+
|
|
226
|
+
const Component = () => {
|
|
227
|
+
return (
|
|
228
|
+
<Breadcrumbs>
|
|
229
|
+
<Breadcrumbs.Item>
|
|
230
|
+
<Breadcrumbs.Link href="">Previous step</Breadcrumbs.Link>
|
|
231
|
+
</Breadcrumbs.Item>
|
|
232
|
+
<Breadcrumbs.Item>
|
|
233
|
+
<Breadcrumbs.Link href="" ariaCurrent="step">
|
|
234
|
+
Current step
|
|
235
|
+
</Breadcrumbs.Link>
|
|
236
|
+
</Breadcrumbs.Item>
|
|
237
|
+
<Breadcrumbs.Item>
|
|
238
|
+
<Breadcrumbs.Link href="">Next step</Breadcrumbs.Link>
|
|
239
|
+
</Breadcrumbs.Item>
|
|
240
|
+
</Breadcrumbs>
|
|
241
|
+
);
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export default Component;
|
|
245
|
+
```
|