@neo4j-ndl/react 4.16.7 → 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/lib/cjs/color-picker/ColorPicker.js +3 -1
- package/lib/cjs/color-picker/ColorPicker.js.map +1 -1
- package/lib/cjs/color-picker/stories/color-picker-dialog.story.js +40 -0
- package/lib/cjs/color-picker/stories/color-picker-dialog.story.js.map +1 -0
- package/lib/cjs/color-picker/stories/color-picker-popover.story.js +32 -0
- package/lib/cjs/color-picker/stories/color-picker-popover.story.js.map +1 -0
- package/lib/cjs/color-picker/stories/index.js +9 -1
- package/lib/cjs/color-picker/stories/index.js.map +1 -1
- package/lib/cjs/popover/use-popover.js +1 -1
- package/lib/cjs/popover/use-popover.js.map +1 -1
- package/lib/cjs/select/Select.js +2 -0
- package/lib/cjs/select/Select.js.map +1 -1
- package/lib/esm/color-picker/ColorPicker.js +3 -1
- package/lib/esm/color-picker/ColorPicker.js.map +1 -1
- package/lib/esm/color-picker/stories/color-picker-dialog.story.js +38 -0
- package/lib/esm/color-picker/stories/color-picker-dialog.story.js.map +1 -0
- package/lib/esm/color-picker/stories/color-picker-popover.story.js +30 -0
- package/lib/esm/color-picker/stories/color-picker-popover.story.js.map +1 -0
- package/lib/esm/color-picker/stories/index.js +6 -0
- package/lib/esm/color-picker/stories/index.js.map +1 -1
- package/lib/esm/popover/use-popover.js +1 -1
- package/lib/esm/popover/use-popover.js.map +1 -1
- package/lib/esm/select/Select.js +2 -0
- package/lib/esm/select/Select.js.map +1 -1
- package/lib/types/color-picker/ColorPicker.d.ts +4 -0
- package/lib/types/color-picker/ColorPicker.d.ts.map +1 -1
- package/lib/types/color-picker/stories/color-picker-dialog.story.d.ts +24 -0
- package/lib/types/color-picker/stories/color-picker-dialog.story.d.ts.map +1 -0
- package/lib/types/color-picker/stories/color-picker-popover.story.d.ts +24 -0
- package/lib/types/color-picker/stories/color-picker-popover.story.d.ts.map +1 -0
- package/lib/types/color-picker/stories/index.d.ts +4 -0
- package/lib/types/color-picker/stories/index.d.ts.map +1 -1
- package/lib/types/select/Select.d.ts.map +1 -1
- 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,167 @@
|
|
|
1
|
+
# GraphLabel
|
|
2
|
+
|
|
3
|
+
Import: `import { GraphLabel } from '@neo4j-ndl/react'`
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### GraphLabel
|
|
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 displayed inside the label |
|
|
13
|
+
| `color` | `string` | | | The background color of the label |
|
|
14
|
+
| `isDisabled` | `boolean` | | `false` | Whether the label is disabled |
|
|
15
|
+
| `isFluid` | `boolean` | | `false` | Whether the label should expand to full available width |
|
|
16
|
+
| `isSelected` | `boolean` | | `false` | Whether the label is selected |
|
|
17
|
+
| `onClick` | `((event: MouseEvent<HTMLButtonElement, MouseEvent>) => void)` | | | Callback function that is called when the label is clicked |
|
|
18
|
+
| `ref` | `any` | | | A ref to apply to the root element. |
|
|
19
|
+
| `size` | `'large' \| 'small'` | | `large` | The size of the label |
|
|
20
|
+
| `type` | `'node' \| 'propertyKey' \| 'relationship' \| 'relationshipLeft' \| 'relationshipRight'` | | `node` | The type of label |
|
|
21
|
+
|
|
22
|
+
## Examples
|
|
23
|
+
|
|
24
|
+
### Color
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
28
|
+
|
|
29
|
+
import { tokens } from '@neo4j-ndl/base';
|
|
30
|
+
import { GraphLabel } from '@neo4j-ndl/react';
|
|
31
|
+
|
|
32
|
+
const Component = () => {
|
|
33
|
+
return (
|
|
34
|
+
<div className="n-flex n-gap-token-16">
|
|
35
|
+
<GraphLabel type="node" color={tokens.graph['1']}>
|
|
36
|
+
Node
|
|
37
|
+
</GraphLabel>
|
|
38
|
+
<GraphLabel type="node" color={tokens.graph['3']}>
|
|
39
|
+
Node
|
|
40
|
+
</GraphLabel>
|
|
41
|
+
<GraphLabel type="node" color={tokens.graph['12']}>
|
|
42
|
+
Node
|
|
43
|
+
</GraphLabel>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default Component;
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Disabled
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
55
|
+
|
|
56
|
+
import { GraphLabel } from '@neo4j-ndl/react';
|
|
57
|
+
|
|
58
|
+
const Component = () => {
|
|
59
|
+
return (
|
|
60
|
+
<GraphLabel type="node" isDisabled>
|
|
61
|
+
Node
|
|
62
|
+
</GraphLabel>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default Component;
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Fluid
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
73
|
+
|
|
74
|
+
import { GraphLabel } from '@neo4j-ndl/react';
|
|
75
|
+
|
|
76
|
+
const Component = () => {
|
|
77
|
+
return (
|
|
78
|
+
<GraphLabel type="relationship" isFluid={true}>
|
|
79
|
+
Long long long long long long long long long long long long label text
|
|
80
|
+
that is fluid
|
|
81
|
+
</GraphLabel>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export default Component;
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Non Interactive
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
92
|
+
|
|
93
|
+
import { GraphLabel } from '@neo4j-ndl/react';
|
|
94
|
+
|
|
95
|
+
const Component = () => {
|
|
96
|
+
return (
|
|
97
|
+
<GraphLabel type="node" as="span">
|
|
98
|
+
Label
|
|
99
|
+
</GraphLabel>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export default Component;
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Selected
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
110
|
+
|
|
111
|
+
import { GraphLabel } from '@neo4j-ndl/react';
|
|
112
|
+
|
|
113
|
+
const Component = () => {
|
|
114
|
+
return (
|
|
115
|
+
<GraphLabel type="node" isSelected>
|
|
116
|
+
Label
|
|
117
|
+
</GraphLabel>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export default Component;
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Sizes
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
128
|
+
|
|
129
|
+
import { GraphLabel } from '@neo4j-ndl/react';
|
|
130
|
+
|
|
131
|
+
const Component = () => {
|
|
132
|
+
return (
|
|
133
|
+
<div className="n-flex n-gap-token-16">
|
|
134
|
+
<GraphLabel type="node" size="small">
|
|
135
|
+
Label
|
|
136
|
+
</GraphLabel>
|
|
137
|
+
<GraphLabel type="node" size="large">
|
|
138
|
+
Label
|
|
139
|
+
</GraphLabel>
|
|
140
|
+
</div>
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export default Component;
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Types
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
151
|
+
|
|
152
|
+
import { GraphLabel } from '@neo4j-ndl/react';
|
|
153
|
+
|
|
154
|
+
const Component = () => {
|
|
155
|
+
return (
|
|
156
|
+
<div className="n-flex n-gap-token-16">
|
|
157
|
+
<GraphLabel type="node">Node</GraphLabel>
|
|
158
|
+
<GraphLabel type="propertyKey">Property Key</GraphLabel>
|
|
159
|
+
<GraphLabel type="relationship">Relationship</GraphLabel>
|
|
160
|
+
<GraphLabel type="relationshipLeft">Relationship Left</GraphLabel>
|
|
161
|
+
<GraphLabel type="relationshipRight">Relationship Right</GraphLabel>
|
|
162
|
+
</div>
|
|
163
|
+
);
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export default Component;
|
|
167
|
+
```
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# IconButtonArrayComponent
|
|
2
|
+
|
|
3
|
+
Import: `import { IconButtonArrayComponent } from '@neo4j-ndl/react'`
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### IconButtonArrayComponent
|
|
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 displayed in the icon button array |
|
|
13
|
+
| `isFloating` | `boolean` | | `false` | Whether the icon button array is floating |
|
|
14
|
+
| `orientation` | `'horizontal' \| 'vertical'` | | `horizontal` | Orientation of the icon button array |
|
|
15
|
+
| `ref` | `any` | | | A ref to apply to the root element. |
|
|
16
|
+
| `size` | `'large' \| 'medium' \| 'small'` | | `medium` | Size of the icon button array |
|
|
17
|
+
|
|
18
|
+
### IconButtonArray.CollapsibleButtonWrapper
|
|
19
|
+
|
|
20
|
+
| Prop | Type | Required | Default | Description |
|
|
21
|
+
|------|------|----------|---------|-------------|
|
|
22
|
+
| `children` | `ReactElement<CleanIconButtonButtonProps & { as?: ElementType<any, keyof IntrinsicElements>; } & BaseProps<ElementType<any, keyof IntrinsicElements>>, string \| JSXElementConstructor<...>> \| ReactElement<...>[]` | ✅ | | Icon buttons to be displayed in the collapsible button wrapper |
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
### Collapsible
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
30
|
+
|
|
31
|
+
import { CleanIconButton, IconButtonArray } from '@neo4j-ndl/react';
|
|
32
|
+
import {
|
|
33
|
+
FunnelIconOutline,
|
|
34
|
+
MagnifyingGlassIconOutline,
|
|
35
|
+
PencilIconOutline,
|
|
36
|
+
UserCircleIconOutline,
|
|
37
|
+
} from '@neo4j-ndl/react/icons';
|
|
38
|
+
|
|
39
|
+
const Component = () => {
|
|
40
|
+
return (
|
|
41
|
+
<IconButtonArray orientation="horizontal" size="medium">
|
|
42
|
+
<CleanIconButton description="Search">
|
|
43
|
+
<MagnifyingGlassIconOutline />
|
|
44
|
+
</CleanIconButton>
|
|
45
|
+
<CleanIconButton description="Filter">
|
|
46
|
+
<FunnelIconOutline />
|
|
47
|
+
</CleanIconButton>
|
|
48
|
+
<IconButtonArray.CollapsibleButtonWrapper>
|
|
49
|
+
<CleanIconButton description="User">
|
|
50
|
+
<UserCircleIconOutline />
|
|
51
|
+
</CleanIconButton>
|
|
52
|
+
<CleanIconButton description="Edit">
|
|
53
|
+
<PencilIconOutline />
|
|
54
|
+
</CleanIconButton>
|
|
55
|
+
</IconButtonArray.CollapsibleButtonWrapper>
|
|
56
|
+
</IconButtonArray>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default Component;
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Floating
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
67
|
+
|
|
68
|
+
import { CleanIconButton, IconButtonArray } from '@neo4j-ndl/react';
|
|
69
|
+
import {
|
|
70
|
+
FunnelIconOutline,
|
|
71
|
+
MagnifyingGlassIconOutline,
|
|
72
|
+
} from '@neo4j-ndl/react/icons';
|
|
73
|
+
|
|
74
|
+
const Component = () => {
|
|
75
|
+
return (
|
|
76
|
+
<IconButtonArray orientation="horizontal" isFloating={true} size="medium">
|
|
77
|
+
<CleanIconButton description="Search">
|
|
78
|
+
<MagnifyingGlassIconOutline />
|
|
79
|
+
</CleanIconButton>
|
|
80
|
+
<CleanIconButton description="Filter">
|
|
81
|
+
<FunnelIconOutline />
|
|
82
|
+
</CleanIconButton>
|
|
83
|
+
</IconButtonArray>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export default Component;
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Horizontal
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
94
|
+
|
|
95
|
+
import { CleanIconButton, IconButtonArray } from '@neo4j-ndl/react';
|
|
96
|
+
import {
|
|
97
|
+
FunnelIconOutline,
|
|
98
|
+
MagnifyingGlassIconOutline,
|
|
99
|
+
} from '@neo4j-ndl/react/icons';
|
|
100
|
+
|
|
101
|
+
const Component = () => {
|
|
102
|
+
return (
|
|
103
|
+
<IconButtonArray orientation="horizontal" size="medium">
|
|
104
|
+
<CleanIconButton description="Search">
|
|
105
|
+
<MagnifyingGlassIconOutline />
|
|
106
|
+
</CleanIconButton>
|
|
107
|
+
<CleanIconButton description="Filter">
|
|
108
|
+
<FunnelIconOutline />
|
|
109
|
+
</CleanIconButton>
|
|
110
|
+
</IconButtonArray>
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export default Component;
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Sizes
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
121
|
+
|
|
122
|
+
import { CleanIconButton, IconButtonArray } from '@neo4j-ndl/react';
|
|
123
|
+
import {
|
|
124
|
+
FunnelIconOutline,
|
|
125
|
+
MagnifyingGlassIconOutline,
|
|
126
|
+
} from '@neo4j-ndl/react/icons';
|
|
127
|
+
|
|
128
|
+
const Component = () => {
|
|
129
|
+
return (
|
|
130
|
+
<div className="n-flex n-items-start n-gap-token-16">
|
|
131
|
+
<IconButtonArray orientation="horizontal" size="small">
|
|
132
|
+
<CleanIconButton description="Search">
|
|
133
|
+
<MagnifyingGlassIconOutline />
|
|
134
|
+
</CleanIconButton>
|
|
135
|
+
<CleanIconButton description="Filter">
|
|
136
|
+
<FunnelIconOutline />
|
|
137
|
+
</CleanIconButton>
|
|
138
|
+
</IconButtonArray>
|
|
139
|
+
<IconButtonArray orientation="horizontal" size="medium">
|
|
140
|
+
<CleanIconButton description="Search">
|
|
141
|
+
<MagnifyingGlassIconOutline />
|
|
142
|
+
</CleanIconButton>
|
|
143
|
+
<CleanIconButton description="Filter">
|
|
144
|
+
<FunnelIconOutline />
|
|
145
|
+
</CleanIconButton>
|
|
146
|
+
</IconButtonArray>
|
|
147
|
+
<IconButtonArray orientation="horizontal" size="large">
|
|
148
|
+
<CleanIconButton description="Search">
|
|
149
|
+
<MagnifyingGlassIconOutline />
|
|
150
|
+
</CleanIconButton>
|
|
151
|
+
<CleanIconButton description="Filter">
|
|
152
|
+
<FunnelIconOutline />
|
|
153
|
+
</CleanIconButton>
|
|
154
|
+
</IconButtonArray>
|
|
155
|
+
</div>
|
|
156
|
+
);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export default Component;
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Vertical
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
166
|
+
|
|
167
|
+
import { CleanIconButton, IconButtonArray } from '@neo4j-ndl/react';
|
|
168
|
+
import {
|
|
169
|
+
FunnelIconOutline,
|
|
170
|
+
MagnifyingGlassIconOutline,
|
|
171
|
+
} from '@neo4j-ndl/react/icons';
|
|
172
|
+
|
|
173
|
+
const Component = () => {
|
|
174
|
+
return (
|
|
175
|
+
<IconButtonArray orientation="vertical" size="medium">
|
|
176
|
+
<CleanIconButton description="Search">
|
|
177
|
+
<MagnifyingGlassIconOutline />
|
|
178
|
+
</CleanIconButton>
|
|
179
|
+
<CleanIconButton description="Filter">
|
|
180
|
+
<FunnelIconOutline />
|
|
181
|
+
</CleanIconButton>
|
|
182
|
+
</IconButtonArray>
|
|
183
|
+
);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export default Component;
|
|
187
|
+
```
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# IconButton
|
|
2
|
+
|
|
3
|
+
Import: `import { IconButton } from '@neo4j-ndl/react'`
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### IconButton
|
|
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` | | | |
|
|
13
|
+
| `description` | `string \| null` | ✅ | | 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} |
|
|
14
|
+
| `descriptionKbdProps` | `(KbdProps & { as?: ElementType<any, keyof IntrinsicElements>; } & BaseProps<ElementType<any, keyof IntrinsicElements>>)` | | | The Kbd components that will be displayed in the tooltip after the description text, this does not include the keyboard shortcut functionality this only displays the Kbd components. |
|
|
15
|
+
| `isActive` | `boolean` | | | Active - used for open context menus for example |
|
|
16
|
+
| `isDisabled` | `boolean` | | `false` | If the icon button is in disabled state |
|
|
17
|
+
| `isFloating` | `boolean` | | `false` | If the button is in floating state |
|
|
18
|
+
| `isLoading` | `boolean` | | `false` | If the button is doing something Async, it will display a loading spinner |
|
|
19
|
+
| `loadingMessage` | `string` | | | Accessible message for screen readers when the button is in a loading state |
|
|
20
|
+
| `onClick` | `((e: MouseEvent<HTMLButtonElement, MouseEvent>) => void)` | | | Click handler |
|
|
21
|
+
| `ref` | `any` | | | A ref to apply to the root element. |
|
|
22
|
+
| `size` | `'large' \| 'medium' \| 'small'` | | `medium` | Size of button |
|
|
23
|
+
| `tooltipProps` | `TooltipObjectProps` | | | Props for the tooltip component. |
|
|
24
|
+
| `variant` | `'danger' \| 'neutral'` | | `neutral` | Variant of the button |
|
|
25
|
+
|
|
26
|
+
## Accessibility
|
|
27
|
+
|
|
28
|
+
## Implementation guidelines
|
|
29
|
+
|
|
30
|
+
An IconButton must have the `description` prop set for it to be accessible. The description is used as the aria-label for screen readers, unless aria-label is set manually. IconButtons are interactive elements that allow users to trigger actions with either `Space` or `Enter`. Try to avoid disabling buttons since they are removed from the accessibility tree. Instead, give the user feedback on the action.
|
|
31
|
+
|
|
32
|
+
## Examples
|
|
33
|
+
|
|
34
|
+
### Default
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
38
|
+
|
|
39
|
+
import { IconButton } from '@neo4j-ndl/react';
|
|
40
|
+
import { MagnifyingGlassIconOutline } from '@neo4j-ndl/react/icons';
|
|
41
|
+
|
|
42
|
+
const Component = () => {
|
|
43
|
+
return (
|
|
44
|
+
<IconButton description="Search">
|
|
45
|
+
<MagnifyingGlassIconOutline />
|
|
46
|
+
</IconButton>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default Component;
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Active
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
57
|
+
|
|
58
|
+
import { IconButton } from '@neo4j-ndl/react';
|
|
59
|
+
import { MagnifyingGlassIconOutline } from '@neo4j-ndl/react/icons';
|
|
60
|
+
|
|
61
|
+
const Component = () => {
|
|
62
|
+
return (
|
|
63
|
+
<IconButton description="Search" isActive>
|
|
64
|
+
<MagnifyingGlassIconOutline />
|
|
65
|
+
</IconButton>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export default Component;
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Disabled
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
76
|
+
|
|
77
|
+
import { IconButton } from '@neo4j-ndl/react';
|
|
78
|
+
import { MagnifyingGlassIconOutline } from '@neo4j-ndl/react/icons';
|
|
79
|
+
|
|
80
|
+
const Component = () => {
|
|
81
|
+
return (
|
|
82
|
+
<IconButton description="Search" isDisabled>
|
|
83
|
+
<MagnifyingGlassIconOutline />
|
|
84
|
+
</IconButton>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export default Component;
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Floating
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
95
|
+
|
|
96
|
+
import { IconButton } from '@neo4j-ndl/react';
|
|
97
|
+
import { MagnifyingGlassIconOutline } from '@neo4j-ndl/react/icons';
|
|
98
|
+
|
|
99
|
+
const Component = () => {
|
|
100
|
+
return (
|
|
101
|
+
<IconButton description="Search" isFloating>
|
|
102
|
+
<MagnifyingGlassIconOutline />
|
|
103
|
+
</IconButton>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export default Component;
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Loading
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
114
|
+
|
|
115
|
+
import { IconButton } from '@neo4j-ndl/react';
|
|
116
|
+
import { MagnifyingGlassIconOutline } from '@neo4j-ndl/react/icons';
|
|
117
|
+
|
|
118
|
+
const Component = () => {
|
|
119
|
+
return (
|
|
120
|
+
<IconButton description="Search" isLoading loadingMessage="Loading">
|
|
121
|
+
<MagnifyingGlassIconOutline />
|
|
122
|
+
</IconButton>
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export default Component;
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Sizes
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
133
|
+
|
|
134
|
+
import { IconButton, Typography } from '@neo4j-ndl/react';
|
|
135
|
+
import { MagnifyingGlassIconOutline } from '@neo4j-ndl/react/icons';
|
|
136
|
+
|
|
137
|
+
const Component = () => {
|
|
138
|
+
return (
|
|
139
|
+
<div className="n-flex n-flex-col n-gap-token-16">
|
|
140
|
+
<div className="n-flex n-flex-row n-gap-token-16 n-items-center">
|
|
141
|
+
<IconButton description="Search" size="small">
|
|
142
|
+
<MagnifyingGlassIconOutline />
|
|
143
|
+
</IconButton>
|
|
144
|
+
<Typography variant="label"> Small</Typography>
|
|
145
|
+
</div>
|
|
146
|
+
<div className="n-flex n-flex-row n-gap-token-16 n-items-center">
|
|
147
|
+
<IconButton description="Search" size="medium">
|
|
148
|
+
<MagnifyingGlassIconOutline />
|
|
149
|
+
</IconButton>
|
|
150
|
+
<Typography variant="label"> Medium</Typography>
|
|
151
|
+
</div>
|
|
152
|
+
<div className="n-flex n-flex-row n-gap-token-16 n-items-center">
|
|
153
|
+
<IconButton description="Search" size="large">
|
|
154
|
+
<MagnifyingGlassIconOutline />
|
|
155
|
+
</IconButton>
|
|
156
|
+
<Typography variant="label"> Large</Typography>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export default Component;
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Tone
|
|
166
|
+
|
|
167
|
+
```tsx
|
|
168
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
169
|
+
|
|
170
|
+
import { IconButton, Typography } from '@neo4j-ndl/react';
|
|
171
|
+
import { MagnifyingGlassIconOutline } from '@neo4j-ndl/react/icons';
|
|
172
|
+
|
|
173
|
+
const Component = () => {
|
|
174
|
+
return (
|
|
175
|
+
<div className="n-flex n-flex-col n-gap-token-16">
|
|
176
|
+
<div className="n-flex n-flex-row n-gap-token-16 n-items-center">
|
|
177
|
+
<IconButton description="Search" variant="neutral">
|
|
178
|
+
<MagnifyingGlassIconOutline />
|
|
179
|
+
</IconButton>
|
|
180
|
+
<Typography variant="label">Default</Typography>
|
|
181
|
+
</div>
|
|
182
|
+
<div className="n-flex n-flex-row n-gap-token-16 n-items-center">
|
|
183
|
+
<IconButton description="Search" variant="danger">
|
|
184
|
+
<MagnifyingGlassIconOutline />
|
|
185
|
+
</IconButton>
|
|
186
|
+
<Typography variant="label">Danger</Typography>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export default Component;
|
|
193
|
+
```
|