aidos-ui 4.0.0 → 4.0.2
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/.claude/settings.local.json +14 -1
- package/CLAUDE.md +72 -0
- package/dist/BaseButton.js.map +1 -1
- package/dist/BaseLink.js.map +1 -1
- package/dist/BaseListItem.d.ts +1 -1
- package/dist/Calendar.d.ts +2 -2
- package/dist/Card.js +1 -1
- package/dist/Card.js.map +1 -1
- package/dist/DarkMode.js.map +1 -1
- package/dist/DatePicker.js.map +1 -1
- package/dist/Dialog.d.ts +3 -3
- package/dist/Dialog.js +7 -1
- package/dist/Dialog.js.map +1 -1
- package/dist/Dropdown.js.map +1 -1
- package/dist/Icon.d.ts +3 -3
- package/dist/Icon.js +2 -21
- package/dist/Icon.js.map +1 -1
- package/dist/Interactable.js.map +1 -1
- package/dist/NextJSRouterState.js.map +1 -1
- package/dist/OnVisible.d.ts +1 -1
- package/dist/OnVisible.js.map +1 -1
- package/dist/Popover.d.ts +3 -3
- package/dist/Popover.js +3 -1
- package/dist/Popover.js.map +1 -1
- package/dist/Providers.d.ts +2 -2
- package/dist/RangeInput.d.ts +1 -1
- package/dist/RootView.js.map +1 -1
- package/dist/Select.d.ts +0 -1
- package/dist/Storage.d.ts +2 -1
- package/dist/Storage.js.map +1 -1
- package/dist/Stream.js.map +1 -1
- package/dist/Text.js.map +1 -1
- package/dist/TextInput.d.ts +3 -2
- package/dist/TextInput.js +13 -4
- package/dist/TextInput.js.map +1 -1
- package/dist/TextPairing.js.map +1 -1
- package/dist/Tooltip.d.ts +2 -2
- package/dist/Tooltip.js +3 -2
- package/dist/Tooltip.js.map +1 -1
- package/dist/aria.js.map +1 -1
- package/dist/hash.js.map +1 -1
- package/dist/jss.d.ts +11 -6
- package/dist/jss.js +47 -2
- package/dist/jss.js.map +1 -1
- package/dist/numberToBase.js.map +1 -1
- package/dist/stateMachineContextFactory.js.map +1 -1
- package/dist/useCookie.js.map +1 -1
- package/dist/useKeyboard.js.map +1 -1
- package/dist/useNavigation.js.map +1 -1
- package/dist/useRefEffect.js.map +1 -1
- package/next-env.d.ts +2 -1
- package/next.config.js +2 -1
- package/package.json +27 -20
- package/src/BaseListItem.tsx +1 -1
- package/src/Calendar.tsx +2 -2
- package/src/Card.tsx +1 -1
- package/src/Dialog.tsx +10 -4
- package/src/Icon.tsx +4 -30
- package/src/Popover.tsx +6 -4
- package/src/Providers.tsx +1 -1
- package/src/RangeInput.tsx +1 -1
- package/src/Storage.tsx +1 -1
- package/src/TextInput.tsx +17 -5
- package/src/Tooltip.tsx +5 -4
- package/src/docs/mdx.tsx +40 -0
- package/src/docs/searchIndex.ts +1 -1
- package/src/jss.tsx +55 -3
- package/src/pages/Badge.mdx +136 -14
- package/src/pages/Button.mdx +121 -63
- package/src/pages/Calendar.mdx +196 -2
- package/src/pages/Card.mdx +123 -47
- package/src/pages/Checkbox.mdx +103 -28
- package/src/pages/Dialog.mdx +172 -7
- package/src/pages/FlexLayout.mdx +185 -51
- package/src/pages/Hashing.mdx +199 -8
- package/src/pages/Icon.mdx +150 -42
- package/src/pages/IconButton.mdx +127 -116
- package/src/pages/Link.mdx +118 -47
- package/src/pages/List.mdx +167 -283
- package/src/pages/ListHeader.mdx +157 -27
- package/src/pages/Popover.mdx +177 -55
- package/src/pages/ProgressBar.mdx +186 -6
- package/src/pages/ProgressCircle.mdx +196 -13
- package/src/pages/RangeInput.mdx +189 -61
- package/src/pages/Tabs.mdx +202 -346
- package/src/pages/Text.mdx +102 -81
- package/src/pages/TextInput.mdx +169 -44
- package/src/pages/TextPairing.mdx +164 -115
- package/src/pages/TimeInput.mdx +142 -37
- package/src/pages/Tooltip.mdx +99 -12
- package/src/pages/_app.tsx +13 -3
- package/src/pages/css-in-js.mdx +196 -83
- package/src/pages/navigation.mdx +122 -20
- package/src/pages/useCookie.mdx +168 -7
- package/src/pages/useKeyboard.mdx +242 -5
- package/src/pages/useNavigation.mdx +244 -16
- package/src/pages/usePromise.mdx +271 -6
- package/src/pages/useRefEffect.mdx +230 -28
- package/tsconfig.json +13 -4
package/src/pages/Icon.mdx
CHANGED
|
@@ -4,60 +4,168 @@ import { Column } from "../Column";
|
|
|
4
4
|
|
|
5
5
|
# Icon
|
|
6
6
|
|
|
7
|
-
The `Icon` component
|
|
7
|
+
The `Icon` component displays vector icons using [Iconify](https://iconify.design/) under the hood, giving you access to 200,000+ icons from 150+ icon sets including Font Awesome, Material Design, and more.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Required | Description |
|
|
14
|
+
|------|------|----------|-------------|
|
|
15
|
+
| `icon` | `IconType` | Yes | The icon identifier (e.g., `"fa-check"`, `"fa-github"`) |
|
|
16
|
+
| `size` | `Size` | Yes | Icon size: `"xsmall"` (8px), `"small"` (12px), `"medium"` (18px), `"large"` (24px), `"xlarge"` (32px), `"xxlarge"` (48px), `"xxxlarge"` (64px) |
|
|
17
|
+
| `color` | `TextColor` | Yes | Icon color: `"primary"`, `"secondary"`, `"highlight"`, `"negative"`, `"subtle"`, `"light"` |
|
|
18
|
+
| `ariaLabel` | `string` | No | Accessible label for screen readers |
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Sizes
|
|
23
|
+
|
|
24
|
+
Icons come in seven predefined sizes to maintain consistency across your application.
|
|
8
25
|
|
|
9
26
|
<Column gap="medium">
|
|
10
|
-
<Row justify="space-around">
|
|
11
|
-
<Icon icon="fa-
|
|
12
|
-
<Icon icon="fa-
|
|
13
|
-
<Icon icon="fa-
|
|
14
|
-
<Icon icon="fa-
|
|
15
|
-
<Icon icon="fa-
|
|
16
|
-
<Icon icon="fa-
|
|
17
|
-
|
|
18
|
-
<Row justify="space-around">
|
|
19
|
-
<Icon icon="fa-reddit-alien" color="primary" size="medium" />
|
|
20
|
-
<Icon icon="fa-reddit-square" color="secondary" size="medium" />
|
|
21
|
-
<Icon icon="fa-refresh" color="highlight" size="medium" />
|
|
22
|
-
<Icon icon="fa-registered" color="negative" size="medium" />
|
|
23
|
-
<Icon icon="fa-remove" color="subtle" size="medium" />
|
|
24
|
-
<Icon icon="fa-renren" color="light" size="medium" />
|
|
25
|
-
</Row>
|
|
26
|
-
<Row justify="space-around">
|
|
27
|
-
<Icon icon="fa-reddit-alien" color="primary" size="large" />
|
|
28
|
-
<Icon icon="fa-reddit-square" color="secondary" size="large" />
|
|
29
|
-
<Icon icon="fa-refresh" color="highlight" size="large" />
|
|
30
|
-
<Icon icon="fa-registered" color="negative" size="large" />
|
|
31
|
-
<Icon icon="fa-remove" color="subtle" size="large" />
|
|
32
|
-
<Icon icon="fa-renren" color="light" size="large" />
|
|
27
|
+
<Row justify="space-around" align="center">
|
|
28
|
+
<Icon icon="fa-star" color="primary" size="xsmall" />
|
|
29
|
+
<Icon icon="fa-star" color="primary" size="small" />
|
|
30
|
+
<Icon icon="fa-star" color="primary" size="medium" />
|
|
31
|
+
<Icon icon="fa-star" color="primary" size="large" />
|
|
32
|
+
<Icon icon="fa-star" color="primary" size="xlarge" />
|
|
33
|
+
<Icon icon="fa-star" color="primary" size="xxlarge" />
|
|
34
|
+
<Icon icon="fa-star" color="primary" size="xxxlarge" />
|
|
33
35
|
</Row>
|
|
34
36
|
</Column>
|
|
35
37
|
|
|
36
38
|
```js
|
|
39
|
+
<Icon icon="fa-star" color="primary" size="xsmall" /> // 8px
|
|
40
|
+
<Icon icon="fa-star" color="primary" size="small" /> // 12px
|
|
41
|
+
<Icon icon="fa-star" color="primary" size="medium" /> // 18px
|
|
42
|
+
<Icon icon="fa-star" color="primary" size="large" /> // 24px
|
|
43
|
+
<Icon icon="fa-star" color="primary" size="xlarge" /> // 32px
|
|
44
|
+
<Icon icon="fa-star" color="primary" size="xxlarge" /> // 48px
|
|
45
|
+
<Icon icon="fa-star" color="primary" size="xxxlarge" /> // 64px
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Colors
|
|
51
|
+
|
|
52
|
+
Icons inherit semantic colors from the theme system, ensuring they adapt correctly to light and dark modes.
|
|
53
|
+
|
|
37
54
|
<Column gap="medium">
|
|
38
55
|
<Row justify="space-around">
|
|
39
|
-
<Icon icon="fa-
|
|
40
|
-
<Icon icon="fa-
|
|
41
|
-
<Icon icon="fa-
|
|
42
|
-
<Icon icon="fa-
|
|
43
|
-
<Icon icon="fa-
|
|
44
|
-
<Icon icon="fa-
|
|
56
|
+
<Icon icon="fa-heart" color="primary" size="large" />
|
|
57
|
+
<Icon icon="fa-heart" color="secondary" size="large" />
|
|
58
|
+
<Icon icon="fa-heart" color="highlight" size="large" />
|
|
59
|
+
<Icon icon="fa-heart" color="negative" size="large" />
|
|
60
|
+
<Icon icon="fa-heart" color="subtle" size="large" />
|
|
61
|
+
<Icon icon="fa-heart" color="light" size="large" />
|
|
45
62
|
</Row>
|
|
63
|
+
</Column>
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
<Icon icon="fa-heart" color="primary" size="large" /> // Main content color
|
|
67
|
+
<Icon icon="fa-heart" color="secondary" size="large" /> // Secondary content
|
|
68
|
+
<Icon icon="fa-heart" color="highlight" size="large" /> // Accent/brand color
|
|
69
|
+
<Icon icon="fa-heart" color="negative" size="large" /> // Error/destructive
|
|
70
|
+
<Icon icon="fa-heart" color="subtle" size="large" /> // Muted/disabled
|
|
71
|
+
<Icon icon="fa-heart" color="light" size="large" /> // Light/inverted
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Icon examples
|
|
77
|
+
|
|
78
|
+
A selection of commonly used icons:
|
|
79
|
+
|
|
80
|
+
<Column gap="medium">
|
|
46
81
|
<Row justify="space-around">
|
|
47
|
-
<Icon icon="fa-
|
|
48
|
-
<Icon icon="fa-
|
|
49
|
-
<Icon icon="fa-
|
|
50
|
-
<Icon icon="fa-
|
|
51
|
-
<Icon icon="fa-
|
|
52
|
-
<Icon icon="fa-
|
|
82
|
+
<Icon icon="fa-check" color="primary" size="medium" />
|
|
83
|
+
<Icon icon="fa-close" color="negative" size="medium" />
|
|
84
|
+
<Icon icon="fa-search" color="secondary" size="medium" />
|
|
85
|
+
<Icon icon="fa-user" color="primary" size="medium" />
|
|
86
|
+
<Icon icon="fa-cog" color="secondary" size="medium" />
|
|
87
|
+
<Icon icon="fa-bell" color="highlight" size="medium" />
|
|
53
88
|
</Row>
|
|
54
89
|
<Row justify="space-around">
|
|
55
|
-
<Icon icon="fa-
|
|
56
|
-
<Icon icon="fa-
|
|
57
|
-
<Icon icon="fa-
|
|
58
|
-
<Icon icon="fa-
|
|
59
|
-
<Icon icon="fa-
|
|
60
|
-
<Icon icon="fa-
|
|
90
|
+
<Icon icon="fa-github" color="primary" size="medium" />
|
|
91
|
+
<Icon icon="fa-twitter" color="primary" size="medium" />
|
|
92
|
+
<Icon icon="fa-linkedin" color="primary" size="medium" />
|
|
93
|
+
<Icon icon="fa-envelope" color="primary" size="medium" />
|
|
94
|
+
<Icon icon="fa-phone" color="primary" size="medium" />
|
|
95
|
+
<Icon icon="fa-globe" color="primary" size="medium" />
|
|
61
96
|
</Row>
|
|
62
97
|
</Column>
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
// Action icons
|
|
101
|
+
<Icon icon="fa-check" color="primary" size="medium" />
|
|
102
|
+
<Icon icon="fa-close" color="negative" size="medium" />
|
|
103
|
+
<Icon icon="fa-search" color="secondary" size="medium" />
|
|
104
|
+
|
|
105
|
+
// Social icons
|
|
106
|
+
<Icon icon="fa-github" color="primary" size="medium" />
|
|
107
|
+
<Icon icon="fa-twitter" color="primary" size="medium" />
|
|
63
108
|
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Accessibility
|
|
113
|
+
|
|
114
|
+
Always provide an `ariaLabel` when the icon conveys meaning that isn't available through surrounding text.
|
|
115
|
+
|
|
116
|
+
```js
|
|
117
|
+
// Decorative icon (no label needed if text explains it)
|
|
118
|
+
<Button>
|
|
119
|
+
<Icon icon="fa-download" color="light" size="small" />
|
|
120
|
+
Download
|
|
121
|
+
</Button>
|
|
122
|
+
|
|
123
|
+
// Meaningful icon (needs label for screen readers)
|
|
124
|
+
<Icon
|
|
125
|
+
icon="fa-warning"
|
|
126
|
+
color="negative"
|
|
127
|
+
size="medium"
|
|
128
|
+
ariaLabel="Warning"
|
|
129
|
+
/>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Preloading icons
|
|
135
|
+
|
|
136
|
+
By default, Iconify loads icons asynchronously from a CDN. To prevent flickering on initial render, you can preload icons by bundling them with your application.
|
|
137
|
+
|
|
138
|
+
**Option 1: Preload an entire icon set**
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
npm install @iconify-json/fa
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
```js
|
|
145
|
+
import { addCollection } from "@iconify/react";
|
|
146
|
+
import faIcons from "@iconify-json/fa/icons.json";
|
|
147
|
+
|
|
148
|
+
// Call once at app initialization (e.g., in _app.tsx)
|
|
149
|
+
addCollection(faIcons);
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Option 2: Preload individual icons**
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
npm install @iconify-icons/fa
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
```js
|
|
159
|
+
import { addIcon } from "@iconify/react";
|
|
160
|
+
import faCheck from "@iconify-icons/fa/check";
|
|
161
|
+
import faClose from "@iconify-icons/fa/close";
|
|
162
|
+
|
|
163
|
+
addIcon("fa:check", faCheck);
|
|
164
|
+
addIcon("fa:close", faClose);
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Finding icons
|
|
170
|
+
|
|
171
|
+
Browse available icons at [Iconify Icon Sets](https://icon-sets.iconify.design/). The component uses Font Awesome 4 icons by default (prefixed with `fa-`), but you can use any Iconify-supported icon set.
|
package/src/pages/IconButton.mdx
CHANGED
|
@@ -1,144 +1,155 @@
|
|
|
1
1
|
import { IconButton } from "../IconButton";
|
|
2
2
|
import { Row } from "../Row";
|
|
3
|
+
import { Column } from "../Column";
|
|
3
4
|
|
|
4
5
|
# IconButton
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
A circular button containing only an icon. Use IconButton for compact actions where space is limited or when the icon alone clearly communicates the action's purpose.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Required | Default | Description |
|
|
14
|
+
|------|------|----------|---------|-------------|
|
|
15
|
+
| `icon` | `IconType` | Yes | - | The icon to display |
|
|
16
|
+
| `size` | `Size` | Yes | - | Button size: `"xsmall"` (20px), `"small"` (24px), `"medium"` (32px), `"large"` (40px), `"xlarge"` (48px) |
|
|
17
|
+
| `color` | `InteractableColor` | Yes | - | `"positive"`, `"secondary"`, `"negative"`, `"dark"`, `"light"` |
|
|
18
|
+
| `onClick` | `function` | Yes | - | Click handler |
|
|
19
|
+
| `bare` | `boolean` | No | `false` | Removes background for a lighter appearance |
|
|
20
|
+
| `border` | `boolean` | No | `false` | Adds a border |
|
|
21
|
+
| `disabled` | `boolean` | No | `false` | Disables interaction |
|
|
22
|
+
| `aria-label` | `string` | No | - | Accessible label (recommended) |
|
|
7
23
|
|
|
8
24
|
---
|
|
9
25
|
|
|
10
26
|
## Basic variants
|
|
11
27
|
|
|
12
|
-
|
|
28
|
+
IconButtons come in different colors to indicate their purpose. Always pair with a clear, recognizable icon.
|
|
13
29
|
|
|
14
30
|
<Row gap="large" align="center" padding="large" justify="center">
|
|
15
|
-
<IconButton
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
onClick={() => {}}
|
|
20
|
-
/>
|
|
21
|
-
<IconButton
|
|
22
|
-
size="medium"
|
|
23
|
-
icon="fa-check"
|
|
24
|
-
color="secondary"
|
|
25
|
-
onClick={() => {}}
|
|
26
|
-
/>
|
|
27
|
-
<IconButton
|
|
28
|
-
size="medium"
|
|
29
|
-
icon="fa-check"
|
|
30
|
-
color="negative"
|
|
31
|
-
onClick={() => {}}
|
|
32
|
-
/>
|
|
33
|
-
<IconButton
|
|
34
|
-
size="medium"
|
|
35
|
-
icon="fa-check"
|
|
36
|
-
color="positive"
|
|
37
|
-
disabled
|
|
38
|
-
onClick={() => {}}
|
|
39
|
-
/>
|
|
31
|
+
<IconButton size="medium" icon="fa-check" color="positive" onClick={() => {}} />
|
|
32
|
+
<IconButton size="medium" icon="fa-pencil" color="secondary" onClick={() => {}} />
|
|
33
|
+
<IconButton size="medium" icon="fa-trash" color="negative" onClick={() => {}} />
|
|
34
|
+
<IconButton size="medium" icon="fa-check" color="positive" disabled onClick={() => {}} />
|
|
40
35
|
</Row>
|
|
41
36
|
|
|
42
37
|
```js
|
|
38
|
+
<IconButton
|
|
39
|
+
icon="fa-check"
|
|
40
|
+
size="medium"
|
|
41
|
+
color="positive"
|
|
42
|
+
aria-label="Confirm"
|
|
43
|
+
onClick={() => {}}
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
<IconButton
|
|
47
|
+
icon="fa-pencil"
|
|
48
|
+
size="medium"
|
|
49
|
+
color="secondary"
|
|
50
|
+
aria-label="Edit"
|
|
51
|
+
onClick={() => {}}
|
|
52
|
+
/>
|
|
53
|
+
|
|
54
|
+
<IconButton
|
|
55
|
+
icon="fa-trash"
|
|
56
|
+
size="medium"
|
|
57
|
+
color="negative"
|
|
58
|
+
aria-label="Delete"
|
|
59
|
+
onClick={() => {}}
|
|
60
|
+
/>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Bare variant
|
|
66
|
+
|
|
67
|
+
The `bare` variant removes the background, creating a subtle button that works well in toolbars or alongside other content.
|
|
68
|
+
|
|
43
69
|
<Row gap="large" align="center" padding="large" justify="center">
|
|
44
|
-
<IconButton
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
onClick={() => {}}
|
|
49
|
-
/>
|
|
50
|
-
<IconButton
|
|
51
|
-
size="medium"
|
|
52
|
-
icon="fa-check"
|
|
53
|
-
color="secondary"
|
|
54
|
-
onClick={() => {}}
|
|
55
|
-
/>
|
|
56
|
-
<IconButton
|
|
57
|
-
size="medium"
|
|
58
|
-
icon="fa-check"
|
|
59
|
-
color="negative"
|
|
60
|
-
onClick={() => {}}
|
|
61
|
-
/>
|
|
62
|
-
<IconButton
|
|
63
|
-
size="medium"
|
|
64
|
-
icon="fa-check"
|
|
65
|
-
color="positive"
|
|
66
|
-
disabled
|
|
67
|
-
onClick={() => {}}
|
|
68
|
-
/>
|
|
70
|
+
<IconButton bare size="medium" icon="fa-check" color="positive" onClick={() => {}} />
|
|
71
|
+
<IconButton bare size="medium" icon="fa-pencil" color="secondary" onClick={() => {}} />
|
|
72
|
+
<IconButton bare size="medium" icon="fa-trash" color="negative" onClick={() => {}} />
|
|
73
|
+
<IconButton bare size="medium" icon="fa-check" color="positive" disabled onClick={() => {}} />
|
|
69
74
|
</Row>
|
|
75
|
+
|
|
76
|
+
```js
|
|
77
|
+
<IconButton
|
|
78
|
+
bare
|
|
79
|
+
icon="fa-close"
|
|
80
|
+
size="medium"
|
|
81
|
+
color="secondary"
|
|
82
|
+
aria-label="Close"
|
|
83
|
+
onClick={() => {}}
|
|
84
|
+
/>
|
|
70
85
|
```
|
|
71
86
|
|
|
72
87
|
---
|
|
73
88
|
|
|
74
|
-
##
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
<Row gap="large" align="center" justify="center">
|
|
79
|
-
<IconButton
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
onClick={() => {}}
|
|
85
|
-
/>
|
|
86
|
-
<IconButton
|
|
87
|
-
size="medium"
|
|
88
|
-
bare
|
|
89
|
-
icon="fa-check"
|
|
90
|
-
color="secondary"
|
|
91
|
-
onClick={() => {}}
|
|
92
|
-
/>
|
|
93
|
-
<IconButton
|
|
94
|
-
size="medium"
|
|
95
|
-
bare
|
|
96
|
-
icon="fa-check"
|
|
97
|
-
color="negative"
|
|
98
|
-
onClick={() => {}}
|
|
99
|
-
/>
|
|
100
|
-
<IconButton
|
|
101
|
-
size="medium"
|
|
102
|
-
bare
|
|
103
|
-
icon="fa-check"
|
|
104
|
-
color="positive"
|
|
105
|
-
disabled
|
|
106
|
-
onClick={() => {}}
|
|
107
|
-
/>
|
|
89
|
+
## Sizes
|
|
90
|
+
|
|
91
|
+
IconButtons scale proportionally, maintaining their circular shape at all sizes.
|
|
92
|
+
|
|
93
|
+
<Row gap="large" align="center" padding="large" justify="center">
|
|
94
|
+
<IconButton size="xsmall" icon="fa-star" color="positive" onClick={() => {}} />
|
|
95
|
+
<IconButton size="small" icon="fa-star" color="positive" onClick={() => {}} />
|
|
96
|
+
<IconButton size="medium" icon="fa-star" color="positive" onClick={() => {}} />
|
|
97
|
+
<IconButton size="large" icon="fa-star" color="positive" onClick={() => {}} />
|
|
98
|
+
<IconButton size="xlarge" icon="fa-star" color="positive" onClick={() => {}} />
|
|
108
99
|
</Row>
|
|
109
100
|
|
|
110
101
|
```js
|
|
111
|
-
<
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
/>
|
|
126
|
-
<IconButton
|
|
127
|
-
size="medium"
|
|
128
|
-
bare
|
|
129
|
-
icon="fa-check"
|
|
130
|
-
color="negative"
|
|
131
|
-
onClick={() => {}}
|
|
132
|
-
/>
|
|
133
|
-
<IconButton
|
|
134
|
-
size="medium"
|
|
135
|
-
bare
|
|
136
|
-
icon="fa-check"
|
|
137
|
-
color="positive"
|
|
138
|
-
disabled
|
|
139
|
-
onClick={() => {}}
|
|
140
|
-
/>
|
|
102
|
+
<IconButton size="xsmall" icon="fa-star" color="positive" onClick={() => {}} /> // 20px
|
|
103
|
+
<IconButton size="small" icon="fa-star" color="positive" onClick={() => {}} /> // 24px
|
|
104
|
+
<IconButton size="medium" icon="fa-star" color="positive" onClick={() => {}} /> // 32px
|
|
105
|
+
<IconButton size="large" icon="fa-star" color="positive" onClick={() => {}} /> // 40px
|
|
106
|
+
<IconButton size="xlarge" icon="fa-star" color="positive" onClick={() => {}} /> // 48px
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Common use cases
|
|
112
|
+
|
|
113
|
+
<Row gap="large" align="center" padding="large" justify="center">
|
|
114
|
+
<IconButton bare size="medium" icon="fa-heart" color="negative" aria-label="Like" onClick={() => {}} />
|
|
115
|
+
<IconButton bare size="medium" icon="fa-bookmark" color="secondary" aria-label="Save" onClick={() => {}} />
|
|
116
|
+
<IconButton bare size="medium" icon="fa-share" color="secondary" aria-label="Share" onClick={() => {}} />
|
|
117
|
+
<IconButton bare size="medium" icon="fa-ellipsis-h" color="secondary" aria-label="More options" onClick={() => {}} />
|
|
141
118
|
</Row>
|
|
119
|
+
|
|
120
|
+
```js
|
|
121
|
+
// Social actions
|
|
122
|
+
<IconButton bare icon="fa-heart" size="medium" color="negative" aria-label="Like" onClick={() => {}} />
|
|
123
|
+
<IconButton bare icon="fa-bookmark" size="medium" color="secondary" aria-label="Save" onClick={() => {}} />
|
|
124
|
+
<IconButton bare icon="fa-share" size="medium" color="secondary" aria-label="Share" onClick={() => {}} />
|
|
125
|
+
|
|
126
|
+
// Menu trigger
|
|
127
|
+
<IconButton bare icon="fa-ellipsis-h" size="medium" color="secondary" aria-label="More options" onClick={() => {}} />
|
|
142
128
|
```
|
|
143
129
|
|
|
144
130
|
---
|
|
131
|
+
|
|
132
|
+
## Accessibility
|
|
133
|
+
|
|
134
|
+
Since IconButtons have no visible text, always provide an `aria-label` to describe the action for screen reader users.
|
|
135
|
+
|
|
136
|
+
```js
|
|
137
|
+
// Good - has accessible label
|
|
138
|
+
<IconButton
|
|
139
|
+
icon="fa-trash"
|
|
140
|
+
size="medium"
|
|
141
|
+
color="negative"
|
|
142
|
+
aria-label="Delete item"
|
|
143
|
+
onClick={() => {}}
|
|
144
|
+
/>
|
|
145
|
+
|
|
146
|
+
// Bad - no accessible label
|
|
147
|
+
<IconButton
|
|
148
|
+
icon="fa-trash"
|
|
149
|
+
size="medium"
|
|
150
|
+
color="negative"
|
|
151
|
+
onClick={() => {}}
|
|
152
|
+
/>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Consider using a `Tooltip` component alongside IconButton to provide visual hints for all users.
|