aidos-ui 3.0.31 → 4.0.1
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/README.md +43 -29
- package/dist/Badge.d.ts +2 -2
- package/dist/Badge.js.map +1 -1
- package/dist/BaseButton.d.ts +2 -2
- package/dist/BaseButton.js +2 -2
- package/dist/BaseButton.js.map +1 -1
- package/dist/BaseInput.d.ts +2 -2
- package/dist/BaseInput.js.map +1 -1
- package/dist/BaseLink.d.ts +2 -2
- package/dist/BaseLink.js +2 -2
- package/dist/BaseLink.js.map +1 -1
- package/dist/BaseListItem.d.ts +3 -3
- package/dist/BaseListItem.js.map +1 -1
- package/dist/BaseView.d.ts +2 -2
- package/dist/BaseView.js.map +1 -1
- package/dist/Calendar.d.ts +4 -4
- package/dist/DarkMode.js.map +1 -1
- package/dist/DateInput.d.ts +2 -2
- package/dist/DatePicker.js.map +1 -1
- package/dist/DatetimeInput.d.ts +2 -2
- package/dist/Dialog.d.ts +3 -3
- package/dist/Dialog.js.map +1 -1
- package/dist/Dropdown.d.ts +3 -3
- 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/IconLink.js +2 -1
- package/dist/IconLink.js.map +1 -1
- package/dist/Interactable.d.ts +4 -4
- package/dist/Interactable.js +2 -2
- package/dist/Interactable.js.map +1 -1
- package/dist/ListButtonItem.js +2 -2
- package/dist/ListButtonItem.js.map +1 -1
- package/dist/ListLinkItem.js +2 -2
- package/dist/ListLinkItem.js.map +1 -1
- package/dist/MenuIcon.js.map +1 -1
- package/dist/NextJSRouter.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 +7 -7
- package/dist/Popover.js +2 -2
- package/dist/Popover.js.map +1 -1
- package/dist/ProgressBar.d.ts +2 -2
- package/dist/ProgressBar.js.map +1 -1
- package/dist/Providers.d.ts +2 -2
- package/dist/Providers.js +2 -2
- package/dist/Providers.js.map +1 -1
- package/dist/RangeInput.d.ts +3 -3
- package/dist/RangeInput.js +2 -2
- package/dist/RangeInput.js.map +1 -1
- package/dist/RootView.js.map +1 -1
- package/dist/Select.d.ts +2 -3
- package/dist/Select.js.map +1 -1
- package/dist/StaticCheckbox.js.map +1 -1
- package/dist/Storage.d.ts +2 -1
- package/dist/Storage.js.map +1 -1
- package/dist/Stream.js.map +1 -1
- package/dist/Sublist.d.ts +2 -2
- package/dist/Tabs.d.ts +4 -4
- package/dist/Tabs.js +2 -4
- package/dist/Tabs.js.map +1 -1
- package/dist/Text.d.ts +2 -2
- package/dist/Text.js.map +1 -1
- package/dist/TextArea.d.ts +2 -2
- package/dist/TextArea.js.map +1 -1
- package/dist/TextInput.d.ts +4 -3
- package/dist/TextInput.js +14 -5
- package/dist/TextInput.js.map +1 -1
- package/dist/TextPairing.d.ts +2 -2
- package/dist/TextPairing.js.map +1 -1
- package/dist/Tooltip.d.ts +4 -4
- 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 +21 -21
- package/dist/jss.js +6 -6
- 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/Badge.tsx +2 -2
- package/src/BaseButton.tsx +4 -4
- package/src/BaseInput.tsx +2 -2
- package/src/BaseLink.tsx +4 -4
- package/src/BaseListItem.tsx +3 -3
- package/src/BaseView.tsx +3 -3
- package/src/Calendar.tsx +4 -4
- package/src/DateInput.tsx +2 -2
- package/src/DatetimeInput.tsx +2 -2
- package/src/Dialog.tsx +3 -3
- package/src/Dropdown.tsx +4 -4
- package/src/Icon.tsx +4 -30
- package/src/IconLink.tsx +2 -1
- package/src/Interactable.tsx +4 -4
- package/src/ListButtonItem.tsx +2 -2
- package/src/ListLinkItem.tsx +2 -2
- package/src/MenuIcon.tsx +2 -2
- package/src/NextJSRouter.tsx +2 -2
- package/src/Popover.tsx +9 -9
- package/src/ProgressBar.tsx +3 -3
- package/src/Providers.tsx +4 -4
- package/src/RangeInput.tsx +5 -5
- package/src/Select.tsx +2 -2
- package/src/StaticCheckbox.tsx +2 -2
- package/src/Storage.tsx +1 -1
- package/src/Sublist.tsx +2 -2
- package/src/Tabs.tsx +4 -6
- package/src/Text.tsx +2 -2
- package/src/TextArea.tsx +2 -2
- package/src/TextInput.tsx +20 -8
- package/src/TextPairing.tsx +2 -2
- package/src/Tooltip.tsx +5 -5
- package/src/docs/mdx.tsx +40 -0
- package/src/docs/searchIndex.ts +1 -1
- package/src/jss.tsx +18 -18
- 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 +14 -4
- 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/jss.tsx
CHANGED
|
@@ -11,13 +11,13 @@ export type Styles = CSS.Properties<
|
|
|
11
11
|
string | number | CSS.Properties<string | number>
|
|
12
12
|
>;
|
|
13
13
|
|
|
14
|
-
export type
|
|
14
|
+
export type JSS =
|
|
15
15
|
| Styles
|
|
16
16
|
| null
|
|
17
17
|
| false
|
|
18
18
|
| undefined
|
|
19
19
|
| { [key: string]: Styles }
|
|
20
|
-
| Array<
|
|
20
|
+
| Array<JSS>;
|
|
21
21
|
|
|
22
22
|
const aliases: {
|
|
23
23
|
[alias: string]: (value: StylesValueType) => [string, StylesValueType][];
|
|
@@ -137,21 +137,21 @@ const getCSS = (key: string, value): [string, string] => {
|
|
|
137
137
|
return [cssProp, cssValue];
|
|
138
138
|
};
|
|
139
139
|
|
|
140
|
-
const
|
|
140
|
+
const flattenJSS = (jss: JSS): Styles => {
|
|
141
141
|
if (!jss) {
|
|
142
142
|
return {};
|
|
143
143
|
} else if (Array.isArray(jss)) {
|
|
144
144
|
// @ts-ignore
|
|
145
|
-
return jss.reduce((acc: Styles, jss:
|
|
146
|
-
return { ...acc, ...
|
|
145
|
+
return jss.reduce((acc: Styles, jss: JSS) => {
|
|
146
|
+
return { ...acc, ...flattenJSS(jss) };
|
|
147
147
|
}, {});
|
|
148
148
|
} else {
|
|
149
149
|
return jss;
|
|
150
150
|
}
|
|
151
151
|
};
|
|
152
152
|
|
|
153
|
-
export const toClassnames = (jss:
|
|
154
|
-
jss =
|
|
153
|
+
export const toClassnames = (jss: JSS): string => {
|
|
154
|
+
jss = flattenJSS(jss);
|
|
155
155
|
|
|
156
156
|
const stylesStack = Object.entries(jss);
|
|
157
157
|
const classNames = [];
|
|
@@ -205,12 +205,12 @@ export const toClassnames = (jss: JSStyle): string => {
|
|
|
205
205
|
|
|
206
206
|
const serverStyles = [];
|
|
207
207
|
|
|
208
|
-
export function
|
|
208
|
+
export function JSSProvider({
|
|
209
209
|
themes,
|
|
210
210
|
children,
|
|
211
211
|
}: {
|
|
212
212
|
themes: { dark: Theme; light: Theme };
|
|
213
|
-
children: JSX.Element;
|
|
213
|
+
children: React.JSX.Element;
|
|
214
214
|
}) {
|
|
215
215
|
const stylesRef = useRef<string[] | null>(null);
|
|
216
216
|
|
|
@@ -324,7 +324,7 @@ export function getSpacing(spacing: Spacing): string {
|
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
-
export function getPadding(padding: Padding):
|
|
327
|
+
export function getPadding(padding: Padding): JSS {
|
|
328
328
|
if (Array.isArray(padding)) {
|
|
329
329
|
const [vertical, horizontal] = padding;
|
|
330
330
|
return {
|
|
@@ -340,7 +340,7 @@ export function getPadding(padding: Padding): JSStyle {
|
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
-
export function getMargin(margin: Margin):
|
|
343
|
+
export function getMargin(margin: Margin): JSS {
|
|
344
344
|
if (Array.isArray(margin)) {
|
|
345
345
|
const [vertical, horizontal] = margin;
|
|
346
346
|
return {
|
|
@@ -534,10 +534,10 @@ const backgroundStyles = {
|
|
|
534
534
|
backgroundColor: cssVar("--highlight"),
|
|
535
535
|
},
|
|
536
536
|
light: {
|
|
537
|
-
backgroundColor: "
|
|
537
|
+
backgroundColor: cssVar("--light-text"),
|
|
538
538
|
},
|
|
539
539
|
dark: {
|
|
540
|
-
backgroundColor: "
|
|
540
|
+
backgroundColor: cssVar("--primary-text"),
|
|
541
541
|
},
|
|
542
542
|
warning: {
|
|
543
543
|
backgroundColor: cssVar("--warning"),
|
|
@@ -559,7 +559,7 @@ const backgroundStyles = {
|
|
|
559
559
|
},
|
|
560
560
|
};
|
|
561
561
|
|
|
562
|
-
export const getBackground = (color: Color):
|
|
562
|
+
export const getBackground = (color: Color): JSS => {
|
|
563
563
|
return backgroundStyles[color];
|
|
564
564
|
};
|
|
565
565
|
|
|
@@ -572,25 +572,25 @@ export const TABLET_MEDIA = `@media (min-width: ${MOBILE}px) and (max-width: ${T
|
|
|
572
572
|
export const LAPTOP_MEDIA = `@media (min-width: ${TABLET}px) and (max-width: ${LAPTOP}px)`;
|
|
573
573
|
export const DESKTOP_MEDIA = `@media (min-width: ${LAPTOP}px)`;
|
|
574
574
|
|
|
575
|
-
export function mobile(jss:
|
|
575
|
+
export function mobile(jss: JSS): { [key: string]: JSS } {
|
|
576
576
|
return {
|
|
577
577
|
[MOBILE_MEDIA]: jss,
|
|
578
578
|
};
|
|
579
579
|
}
|
|
580
580
|
|
|
581
|
-
export function tablet(jss:
|
|
581
|
+
export function tablet(jss: JSS): { [key: string]: JSS } {
|
|
582
582
|
return {
|
|
583
583
|
[TABLET_MEDIA]: jss,
|
|
584
584
|
};
|
|
585
585
|
}
|
|
586
586
|
|
|
587
|
-
export function laptop(jss:
|
|
587
|
+
export function laptop(jss: JSS): { [key: string]: JSS } {
|
|
588
588
|
return {
|
|
589
589
|
[LAPTOP_MEDIA]: jss,
|
|
590
590
|
};
|
|
591
591
|
}
|
|
592
592
|
|
|
593
|
-
export function desktop(jss:
|
|
593
|
+
export function desktop(jss: JSS): { [key: string]: JSS } {
|
|
594
594
|
return {
|
|
595
595
|
[DESKTOP_MEDIA]: jss,
|
|
596
596
|
};
|
package/src/pages/Badge.mdx
CHANGED
|
@@ -1,30 +1,152 @@
|
|
|
1
1
|
import { Badge } from "../Badge";
|
|
2
2
|
import { Row } from "../Row";
|
|
3
|
+
import { Column } from "../Column";
|
|
4
|
+
import { Span } from "../Text";
|
|
5
|
+
import { IconButton } from "../IconButton";
|
|
3
6
|
|
|
4
7
|
# Badge
|
|
5
8
|
|
|
6
|
-
|
|
9
|
+
A small circular indicator used to draw attention to specific UI elements. Common uses include notification counts, status indicators, and visual markers.
|
|
7
10
|
|
|
8
11
|
---
|
|
9
12
|
|
|
10
|
-
|
|
13
|
+
## Props
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
| Prop | Type | Default | Description |
|
|
16
|
+
|------|------|---------|-------------|
|
|
17
|
+
| `size` | `Size` | `"medium"` | Badge size: `"xsmall"` (4px), `"small"` (6px), `"medium"` (12px), `"large"` (18px), `"xlarge"` (24px) |
|
|
18
|
+
| `color` | `Color` | `"highlight"` | Background color from theme |
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Sizes
|
|
23
|
+
|
|
24
|
+
<Row gap="large" align="center" justify="center" padding="medium">
|
|
25
|
+
<Column align="center" gap="small">
|
|
26
|
+
<Badge size="xsmall" />
|
|
27
|
+
<Span size="small" color="secondary">xsmall</Span>
|
|
28
|
+
</Column>
|
|
29
|
+
<Column align="center" gap="small">
|
|
30
|
+
<Badge size="small" />
|
|
31
|
+
<Span size="small" color="secondary">small</Span>
|
|
32
|
+
</Column>
|
|
33
|
+
<Column align="center" gap="small">
|
|
34
|
+
<Badge size="medium" />
|
|
35
|
+
<Span size="small" color="secondary">medium</Span>
|
|
36
|
+
</Column>
|
|
37
|
+
<Column align="center" gap="small">
|
|
38
|
+
<Badge size="large" />
|
|
39
|
+
<Span size="small" color="secondary">large</Span>
|
|
40
|
+
</Column>
|
|
41
|
+
<Column align="center" gap="small">
|
|
42
|
+
<Badge size="xlarge" />
|
|
43
|
+
<Span size="small" color="secondary">xlarge</Span>
|
|
44
|
+
</Column>
|
|
18
45
|
</Row>
|
|
19
46
|
|
|
20
47
|
```js
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
48
|
+
<Badge size="xsmall" /> // 4px
|
|
49
|
+
<Badge size="small" /> // 6px
|
|
50
|
+
<Badge size="medium" /> // 12px (default)
|
|
51
|
+
<Badge size="large" /> // 18px
|
|
52
|
+
<Badge size="xlarge" /> // 24px
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Colors
|
|
58
|
+
|
|
59
|
+
<Row gap="large" align="center" justify="center" padding="medium">
|
|
60
|
+
<Column align="center" gap="small">
|
|
61
|
+
<Badge color="highlight" />
|
|
62
|
+
<Span size="small" color="secondary">highlight</Span>
|
|
63
|
+
</Column>
|
|
64
|
+
<Column align="center" gap="small">
|
|
65
|
+
<Badge color="negative" />
|
|
66
|
+
<Span size="small" color="secondary">negative</Span>
|
|
67
|
+
</Column>
|
|
68
|
+
<Column align="center" gap="small">
|
|
69
|
+
<Badge color="warning" />
|
|
70
|
+
<Span size="small" color="secondary">warning</Span>
|
|
71
|
+
</Column>
|
|
72
|
+
<Column align="center" gap="small">
|
|
73
|
+
<Badge color="divider" />
|
|
74
|
+
<Span size="small" color="secondary">divider</Span>
|
|
75
|
+
</Column>
|
|
27
76
|
</Row>
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
<Badge color="highlight" /> // Accent/brand color
|
|
80
|
+
<Badge color="negative" /> // Error/alert
|
|
81
|
+
<Badge color="warning" /> // Warning
|
|
82
|
+
<Badge color="divider" /> // Neutral/muted
|
|
28
83
|
```
|
|
29
84
|
|
|
30
85
|
---
|
|
86
|
+
|
|
87
|
+
## Common use cases
|
|
88
|
+
|
|
89
|
+
### Notification indicator
|
|
90
|
+
|
|
91
|
+
<Row gap="medium" align="center" padding="medium">
|
|
92
|
+
<Row jss={{ position: "relative" }}>
|
|
93
|
+
<IconButton bare icon="fa-bell" size="large" color="secondary" onClick={() => {}} />
|
|
94
|
+
<Badge size="small" color="negative" jss={{ position: "absolute", top: 0, right: 0 }} />
|
|
95
|
+
</Row>
|
|
96
|
+
<Span color="secondary">Unread notifications</Span>
|
|
97
|
+
</Row>
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
<Row jss={{ position: "relative" }}>
|
|
101
|
+
<IconButton bare icon="fa-bell" size="large" color="secondary" onClick={() => {}} />
|
|
102
|
+
<Badge
|
|
103
|
+
size="small"
|
|
104
|
+
color="negative"
|
|
105
|
+
jss={{ position: "absolute", top: 0, right: 0 }}
|
|
106
|
+
/>
|
|
107
|
+
</Row>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Status indicator
|
|
111
|
+
|
|
112
|
+
<Column gap="small" padding="medium">
|
|
113
|
+
<Row gap="small" align="center">
|
|
114
|
+
<Badge size="small" color="highlight" />
|
|
115
|
+
<Span>Online</Span>
|
|
116
|
+
</Row>
|
|
117
|
+
<Row gap="small" align="center">
|
|
118
|
+
<Badge size="small" color="warning" />
|
|
119
|
+
<Span>Away</Span>
|
|
120
|
+
</Row>
|
|
121
|
+
<Row gap="small" align="center">
|
|
122
|
+
<Badge size="small" color="divider" />
|
|
123
|
+
<Span>Offline</Span>
|
|
124
|
+
</Row>
|
|
125
|
+
</Column>
|
|
126
|
+
|
|
127
|
+
```js
|
|
128
|
+
<Row gap="small" align="center">
|
|
129
|
+
<Badge size="small" color="highlight" />
|
|
130
|
+
<Span>Online</Span>
|
|
131
|
+
</Row>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Visual markers
|
|
137
|
+
|
|
138
|
+
Use badges to highlight new or important items:
|
|
139
|
+
|
|
140
|
+
<Row gap="medium" align="center" padding="medium">
|
|
141
|
+
<Row gap="small" align="center">
|
|
142
|
+
<Span>New feature</Span>
|
|
143
|
+
<Badge size="xsmall" color="highlight" />
|
|
144
|
+
</Row>
|
|
145
|
+
</Row>
|
|
146
|
+
|
|
147
|
+
```js
|
|
148
|
+
<Row gap="small" align="center">
|
|
149
|
+
<Span>New feature</Span>
|
|
150
|
+
<Badge size="xsmall" color="highlight" />
|
|
151
|
+
</Row>
|
|
152
|
+
```
|
package/src/pages/Button.mdx
CHANGED
|
@@ -1,105 +1,163 @@
|
|
|
1
1
|
import { Button } from "../Button";
|
|
2
2
|
import { Row } from "../Row";
|
|
3
|
+
import { Column } from "../Column";
|
|
4
|
+
import { Icon } from "../Icon";
|
|
3
5
|
|
|
4
6
|
# Button
|
|
5
7
|
|
|
6
|
-
The `Button` component
|
|
8
|
+
The `Button` component enables users to trigger actions with a single click. It supports multiple color variants for different semantic purposes and can include icons.
|
|
7
9
|
|
|
8
10
|
---
|
|
9
11
|
|
|
10
|
-
##
|
|
12
|
+
## Props
|
|
13
|
+
|
|
14
|
+
| Prop | Type | Required | Default | Description |
|
|
15
|
+
|------|------|----------|---------|-------------|
|
|
16
|
+
| `children` | `string` | Yes | - | Button text label |
|
|
17
|
+
| `color` | `InteractableColor` | Yes | - | `"positive"`, `"primary"`, `"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 matching the text color |
|
|
21
|
+
| `disabled` | `boolean` | No | `false` | Disables interaction |
|
|
22
|
+
| `icon` | `IconType` | No | - | Icon to display alongside text |
|
|
23
|
+
| `iconPosition` | `"left"` \| `"right"` | No | `"left"` | Icon placement relative to text |
|
|
24
|
+
| `iconSize` | `Size` | No | `"medium"` | Icon size |
|
|
25
|
+
| `size` | `Size` | No | `"medium"` | Text size |
|
|
26
|
+
| `padding` | `Padding` | No | `"medium"` | Internal padding |
|
|
27
|
+
| `bold` | `boolean` | No | `false` | Bold text |
|
|
11
28
|
|
|
12
|
-
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Color variants
|
|
32
|
+
|
|
33
|
+
Each color variant communicates a different intent to users:
|
|
13
34
|
|
|
14
|
-
- Positive
|
|
15
|
-
- Primary
|
|
16
|
-
- Negative
|
|
17
|
-
- Dark
|
|
18
|
-
- Light: primary actions in a light theme
|
|
19
|
-
- Disabled: actions that are not available
|
|
35
|
+
- **Positive**: Confirmations, submissions, primary actions
|
|
36
|
+
- **Primary**: Secondary or neutral actions
|
|
37
|
+
- **Negative**: Destructive actions like delete or remove
|
|
38
|
+
- **Dark/Light**: Theme-specific variants for special contexts
|
|
20
39
|
|
|
21
40
|
<Row gap="large" align="center" padding="large" justify="center">
|
|
22
|
-
<Button
|
|
23
|
-
<Button
|
|
24
|
-
<Button
|
|
25
|
-
<Button
|
|
26
|
-
<Button
|
|
27
|
-
<Button label="Light" color="light" onClick={() => {}} />
|
|
41
|
+
<Button color="positive" onClick={() => {}}>Positive</Button>
|
|
42
|
+
<Button color="primary" onClick={() => {}}>Primary</Button>
|
|
43
|
+
<Button color="negative" onClick={() => {}}>Negative</Button>
|
|
44
|
+
<Button color="dark" onClick={() => {}}>Dark</Button>
|
|
45
|
+
<Button color="light" onClick={() => {}}>Light</Button>
|
|
28
46
|
</Row>
|
|
29
47
|
|
|
30
48
|
```js
|
|
49
|
+
<Button color="positive" onClick={() => {}}>Positive</Button>
|
|
50
|
+
<Button color="primary" onClick={() => {}}>Primary</Button>
|
|
51
|
+
<Button color="negative" onClick={() => {}}>Negative</Button>
|
|
52
|
+
<Button color="dark" onClick={() => {}}>Dark</Button>
|
|
53
|
+
<Button color="light" onClick={() => {}}>Light</Button>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Bare variant
|
|
59
|
+
|
|
60
|
+
The `bare` prop removes the background color, creating a lighter appearance that integrates well within complex layouts or when you need a less prominent action.
|
|
61
|
+
|
|
31
62
|
<Row gap="large" align="center" padding="large" justify="center">
|
|
32
|
-
<Button
|
|
33
|
-
<Button
|
|
34
|
-
<Button
|
|
35
|
-
<Button
|
|
36
|
-
<Button
|
|
37
|
-
<Button label="Light" color="light" onClick={() => {}} />
|
|
63
|
+
<Button bare color="positive" onClick={() => {}}>Positive</Button>
|
|
64
|
+
<Button bare color="primary" onClick={() => {}}>Primary</Button>
|
|
65
|
+
<Button bare color="negative" onClick={() => {}}>Negative</Button>
|
|
66
|
+
<Button bare color="dark" onClick={() => {}}>Dark</Button>
|
|
67
|
+
<Button bare color="light" onClick={() => {}}>Light</Button>
|
|
38
68
|
</Row>
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
<Button bare color="positive" onClick={() => {}}>Positive</Button>
|
|
72
|
+
<Button bare color="primary" onClick={() => {}}>Primary</Button>
|
|
73
|
+
<Button bare color="negative" onClick={() => {}}>Negative</Button>
|
|
39
74
|
```
|
|
40
75
|
|
|
41
76
|
---
|
|
42
77
|
|
|
43
|
-
##
|
|
78
|
+
## With border
|
|
44
79
|
|
|
45
|
-
|
|
80
|
+
Add a `border` prop to give buttons a defined edge. Works well with `bare` for outlined button styles.
|
|
46
81
|
|
|
47
82
|
<Row gap="large" align="center" padding="large" justify="center">
|
|
48
|
-
<Button bare
|
|
49
|
-
<Button bare
|
|
50
|
-
<Button bare
|
|
51
|
-
<Button bare label="Disabled" color="positive" disabled onClick={() => {}} />
|
|
52
|
-
<Button bare label="Dark" color="dark" onClick={() => {}} />
|
|
53
|
-
<Button bare label="Light" color="light" onClick={() => {}} />
|
|
83
|
+
<Button border bare color="positive" onClick={() => {}}>Positive</Button>
|
|
84
|
+
<Button border bare color="primary" onClick={() => {}}>Primary</Button>
|
|
85
|
+
<Button border bare color="negative" onClick={() => {}}>Negative</Button>
|
|
54
86
|
</Row>
|
|
55
87
|
|
|
56
88
|
```js
|
|
89
|
+
<Button border bare color="positive" onClick={() => {}}>Outlined</Button>
|
|
90
|
+
<Button border bare color="primary" onClick={() => {}}>Outlined</Button>
|
|
91
|
+
<Button border bare color="negative" onClick={() => {}}>Outlined</Button>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## With icon
|
|
97
|
+
|
|
98
|
+
Buttons can include icons to reinforce their purpose. Use `icon` to specify the icon and `iconPosition` to place it on the left or right.
|
|
99
|
+
|
|
57
100
|
<Row gap="large" align="center" padding="large" justify="center">
|
|
58
|
-
<Button
|
|
59
|
-
<Button
|
|
60
|
-
<Button
|
|
61
|
-
<Button bare label="Disabled" color="positive" disabled onClick={() => {}} />
|
|
62
|
-
<Button bare label="Dark" color="dark" onClick={() => {}} />
|
|
63
|
-
<Button bare label="Light" color="light" onClick={() => {}} />
|
|
101
|
+
<Button color="positive" icon="fa-check" onClick={() => {}}>Confirm</Button>
|
|
102
|
+
<Button color="negative" icon="fa-trash" onClick={() => {}}>Delete</Button>
|
|
103
|
+
<Button color="primary" icon="fa-arrow-right" iconPosition="right" onClick={() => {}}>Next</Button>
|
|
64
104
|
</Row>
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
<Button color="positive" icon="fa-check" onClick={() => {}}>
|
|
108
|
+
Confirm
|
|
109
|
+
</Button>
|
|
110
|
+
|
|
111
|
+
<Button color="negative" icon="fa-trash" onClick={() => {}}>
|
|
112
|
+
Delete
|
|
113
|
+
</Button>
|
|
114
|
+
|
|
115
|
+
<Button color="primary" icon="fa-arrow-right" iconPosition="right" onClick={() => {}}>
|
|
116
|
+
Next
|
|
117
|
+
</Button>
|
|
65
118
|
```
|
|
66
119
|
|
|
67
|
-
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Disabled state
|
|
68
123
|
|
|
69
|
-
|
|
124
|
+
Disabled buttons prevent interaction and display a muted appearance. The component uses `aria-disabled` for accessibility.
|
|
70
125
|
|
|
71
126
|
<Row gap="large" align="center" padding="large" justify="center">
|
|
72
|
-
<Button
|
|
73
|
-
<Button
|
|
74
|
-
<Button border bare
|
|
75
|
-
<Button
|
|
76
|
-
border
|
|
77
|
-
bare
|
|
78
|
-
label="Disabled"
|
|
79
|
-
color="positive"
|
|
80
|
-
disabled
|
|
81
|
-
onClick={() => {}}
|
|
82
|
-
/>
|
|
83
|
-
<Button border bare label="Dark" color="dark" onClick={() => {}} />
|
|
84
|
-
<Button border bare label="Light" color="light" onClick={() => {}} />
|
|
127
|
+
<Button color="positive" disabled onClick={() => {}}>Disabled</Button>
|
|
128
|
+
<Button bare color="positive" disabled onClick={() => {}}>Disabled bare</Button>
|
|
129
|
+
<Button border bare color="positive" disabled onClick={() => {}}>Disabled outlined</Button>
|
|
85
130
|
</Row>
|
|
86
131
|
|
|
87
132
|
```js
|
|
133
|
+
<Button color="positive" disabled onClick={() => {}}>
|
|
134
|
+
Disabled
|
|
135
|
+
</Button>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Sizes
|
|
141
|
+
|
|
142
|
+
Control text size with the `size` prop. Available sizes: `"xsmall"`, `"small"`, `"medium"`, `"large"`, `"xlarge"`.
|
|
143
|
+
|
|
88
144
|
<Row gap="large" align="center" padding="large" justify="center">
|
|
89
|
-
<Button
|
|
90
|
-
<Button
|
|
91
|
-
<Button
|
|
92
|
-
<Button
|
|
93
|
-
border
|
|
94
|
-
bare
|
|
95
|
-
label="Disabled"
|
|
96
|
-
color="positive"
|
|
97
|
-
disabled
|
|
98
|
-
onClick={() => {}}
|
|
99
|
-
/>
|
|
100
|
-
<Button border bare label="Dark" color="dark" onClick={() => {}} />
|
|
101
|
-
<Button border bare label="Light" color="light" onClick={() => {}} />
|
|
145
|
+
<Button color="positive" size="small" onClick={() => {}}>Small</Button>
|
|
146
|
+
<Button color="positive" size="medium" onClick={() => {}}>Medium</Button>
|
|
147
|
+
<Button color="positive" size="large" onClick={() => {}}>Large</Button>
|
|
102
148
|
</Row>
|
|
149
|
+
|
|
150
|
+
```js
|
|
151
|
+
<Button color="positive" size="small" onClick={() => {}}>Small</Button>
|
|
152
|
+
<Button color="positive" size="medium" onClick={() => {}}>Medium</Button>
|
|
153
|
+
<Button color="positive" size="large" onClick={() => {}}>Large</Button>
|
|
103
154
|
```
|
|
104
155
|
|
|
105
156
|
---
|
|
157
|
+
|
|
158
|
+
## Accessibility
|
|
159
|
+
|
|
160
|
+
- Buttons use semantic `<button>` elements
|
|
161
|
+
- Disabled state is communicated via `aria-disabled` attribute
|
|
162
|
+
- Focus states are clearly visible with outline styling
|
|
163
|
+
- Click handlers are ignored when disabled, preventing accidental actions
|