@maxio-com/react-ui-components 9.16.0 → 9.17.0
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/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/skills/maxio-react/SKILL.md +69 -0
- package/dist/skills/maxio-react/agents/openai.yaml +4 -0
- package/dist/skills/maxio-react/references/components-action-list.md +92 -0
- package/dist/skills/maxio-react/references/components-action-menu.md +162 -0
- package/dist/skills/maxio-react/references/components-avatar.md +66 -0
- package/dist/skills/maxio-react/references/components-breadcrumbs.md +86 -0
- package/dist/skills/maxio-react/references/components-buttons-button.md +170 -0
- package/dist/skills/maxio-react/references/components-buttons-iconbutton.md +102 -0
- package/dist/skills/maxio-react/references/components-card.md +175 -0
- package/dist/skills/maxio-react/references/components-chip.md +151 -0
- package/dist/skills/maxio-react/references/components-data-table.md +344 -0
- package/dist/skills/maxio-react/references/components-drawer.md +293 -0
- package/dist/skills/maxio-react/references/components-flex.md +185 -0
- package/dist/skills/maxio-react/references/components-forms-checkbox.md +257 -0
- package/dist/skills/maxio-react/references/components-forms-combobox.md +250 -0
- package/dist/skills/maxio-react/references/components-forms-radio-group.md +202 -0
- package/dist/skills/maxio-react/references/components-forms-select.md +295 -0
- package/dist/skills/maxio-react/references/components-forms-textarea.md +187 -0
- package/dist/skills/maxio-react/references/components-forms-textfield.md +254 -0
- package/dist/skills/maxio-react/references/components-grid.md +140 -0
- package/dist/skills/maxio-react/references/components-icon.md +169 -0
- package/dist/skills/maxio-react/references/components-link.md +180 -0
- package/dist/skills/maxio-react/references/components-listbox.md +205 -0
- package/dist/skills/maxio-react/references/components-loading-spinner.md +123 -0
- package/dist/skills/maxio-react/references/components-logo.md +91 -0
- package/dist/skills/maxio-react/references/components-notifications-alert.md +103 -0
- package/dist/skills/maxio-react/references/components-notifications-banner.md +173 -0
- package/dist/skills/maxio-react/references/components-notifications-toast.md +155 -0
- package/dist/skills/maxio-react/references/components-pagination.md +115 -0
- package/dist/skills/maxio-react/references/components-popover.md +176 -0
- package/dist/skills/maxio-react/references/components-progressbar.md +98 -0
- package/dist/skills/maxio-react/references/components-segmentedcontrol.md +292 -0
- package/dist/skills/maxio-react/references/components-tabs.md +193 -0
- package/dist/skills/maxio-react/references/components-tag.md +117 -0
- package/dist/skills/maxio-react/references/components-tile.md +114 -0
- package/dist/skills/maxio-react/references/components-toggle.md +218 -0
- package/dist/skills/maxio-react/references/components-tooltip.md +178 -0
- package/dist/skills/maxio-react/references/components-typography-body.md +101 -0
- package/dist/skills/maxio-react/references/components-typography-code.md +72 -0
- package/dist/skills/maxio-react/references/components-typography-display.md +91 -0
- package/dist/skills/maxio-react/references/components-typography-heading.md +88 -0
- package/dist/skills/maxio-react/references/components-typography-label.md +82 -0
- package/dist/skills/maxio-react/references/deprecated-textinput.md +250 -0
- package/dist/skills/maxio-react/references/foundations-dark-mode.md +85 -0
- package/dist/skills/maxio-react/references/foundations-design-tokens-about.md +108 -0
- package/dist/skills/maxio-react/references/foundations-design-tokens-colors-primitive-colors.md +33 -0
- package/dist/skills/maxio-react/references/foundations-design-tokens-colors-semantic-colors.md +11 -0
- package/dist/skills/maxio-react/references/foundations-start-here.md +128 -0
- package/dist/skills/maxio-react/references/patterns-auth-layout.md +318 -0
- package/dist/skills/maxio-react/references/patterns-side-nav.md +182 -0
- package/dist/skills/maxio-react/references/patterns-top-bar.md +214 -0
- package/package.json +2 -2
- package/typings/index.d.ts +15 -2
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
# TextField
|
|
2
|
+
|
|
3
|
+
## Usage Guidelines
|
|
4
|
+
|
|
5
|
+
### Overview
|
|
6
|
+
|
|
7
|
+
TextField lets users enter or edit a short, single-line text value in a form. Provide a visible label whenever possible, and pair helper or validation messaging with the field so users understand the expected value.
|
|
8
|
+
|
|
9
|
+
#### When to Use
|
|
10
|
+
|
|
11
|
+
- Use when users need to enter a short free-form value.
|
|
12
|
+
- Use when browser input behavior should match the expected value, such as `email`, `url`, `tel`, `search`, or `password`.
|
|
13
|
+
- Use with helper text when users need a format hint, example, or constraint before they type.
|
|
14
|
+
- Use with leading or trailing content for simple visual context, units, prefixes, suffixes, or a small field-level action.
|
|
15
|
+
|
|
16
|
+
#### When Not to Use
|
|
17
|
+
|
|
18
|
+
- Do not use for long-form or multi-line writing. Use TextArea instead.
|
|
19
|
+
- Do not use when users must choose from a known list. Use Select for short lists or ComboBox when filtering helps.
|
|
20
|
+
- Do not use placeholder text as the only label. Provide a visible `label` whenever possible.
|
|
21
|
+
- Do not use for actions or navigation. Use Button, IconButton, or Link instead.
|
|
22
|
+
|
|
23
|
+
### Variants
|
|
24
|
+
|
|
25
|
+
| Variants | Purpose | Usage notes |
|
|
26
|
+
| :------- | :-------------------------------------------- | :--------------------------------------------------------- |
|
|
27
|
+
| `sm` | Compact field for dense interfaces. | Use where form density is high and labels remain readable. |
|
|
28
|
+
| `md` | Default field size. | Use for most forms. |
|
|
29
|
+
| `lg` | Larger field for prominent form rows. | Use sparingly when the field needs more visual emphasis. |
|
|
30
|
+
| `xl` | Field with integrated label and helper/error. | Use when the field needs a stronger contained treatment. |
|
|
31
|
+
|
|
32
|
+
### Behavior
|
|
33
|
+
|
|
34
|
+
- **Mouse and touch**: Users can place the cursor in the field, select text, and activate any nested trailing or leading action independently.
|
|
35
|
+
- **Keyboard**: Users tab to the input, type or edit the value, and use native text editing shortcuts.
|
|
36
|
+
- **Focus management**: Focus lands on the native input. Leading or trailing actions that are interactive should have their own accessible name and keyboard behavior.
|
|
37
|
+
- **Controlled state**: Use `value` and `onChange` when product state owns the value. Use `defaultValue` for simple uncontrolled form fields.
|
|
38
|
+
- **Validation**: Show validation after users submit, blur the field, or otherwise finish interacting. Avoid showing errors before users have a chance to enter a value.
|
|
39
|
+
|
|
40
|
+
### Accessibility
|
|
41
|
+
|
|
42
|
+
- Provide a visible `label` whenever possible. Use `aria-label` or `aria-labelledby` only when a visible label is not available.
|
|
43
|
+
- Use `description` for helper text and `errorMessage` for validation feedback.
|
|
44
|
+
- Pair invalid values with `isInvalid` and an actionable `errorMessage`.
|
|
45
|
+
- Use native text-like `type` values so browsers can expose the right keyboard, autocomplete, and validation behavior.
|
|
46
|
+
- Keep disabled fields out of the editing flow only when users cannot act on them. Use read-only fields when the value should remain focusable or copyable.
|
|
47
|
+
- Do not rely on color alone to communicate validation, disabled, or read-only state.
|
|
48
|
+
|
|
49
|
+
### Content
|
|
50
|
+
|
|
51
|
+
- Write labels as short nouns, such as "Customer name", "Email address", or "Invoice prefix".
|
|
52
|
+
- Use placeholder text for examples, not instructions that replace the label.
|
|
53
|
+
- Use helper text for constraints that prevent errors, such as expected format, length, or source of the value.
|
|
54
|
+
- Write error messages that name the problem and recovery step, such as "Enter a valid email address."
|
|
55
|
+
- Mark optional fields only when the form otherwise implies fields are required.
|
|
56
|
+
|
|
57
|
+
### Related
|
|
58
|
+
|
|
59
|
+
- **[TextArea](components-forms-textarea.md)**: use for longer, multi-line free-form content.
|
|
60
|
+
- **[TextInput](deprecated-textinput.md)**: deprecated predecessor. Use TextField for new React usage.
|
|
61
|
+
- **[Select](components-forms-select.md)**: use when users choose from a shorter closed list.
|
|
62
|
+
- **[ComboBox](components-forms-combobox.md)**: use when users choose from a list and typing should filter options.
|
|
63
|
+
- **[IconButton](components-buttons-iconbutton.md)**: use for compact actions inside trailing or leading content.
|
|
64
|
+
|
|
65
|
+
## React
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
import { TextField } from '@maxio-com/react-ui-components';
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### State Management
|
|
72
|
+
|
|
73
|
+
Use controlled state when product logic needs to validate, transform, save, or share the current value.
|
|
74
|
+
|
|
75
|
+
#### Controlled
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
const [value, setValue] = React.useState('');
|
|
79
|
+
|
|
80
|
+
<TextField label="Customer name" value={value} onChange={setValue} />;
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
#### Uncontrolled
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
<TextField label="Customer name" defaultValue="Acme Co." />
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Imports
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
import { Body, Grid, Icon, IconButton, TextField } from "@maxio-com/react-ui-components";
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Prop Types
|
|
96
|
+
|
|
97
|
+
### TextField
|
|
98
|
+
|
|
99
|
+
| Prop | Type | Required | Default | Description | Source |
|
|
100
|
+
| --- | --- | --- | --- | --- | --- |
|
|
101
|
+
| `className` | `string` | no | - | Additional class name for the text field container | TextFieldProps |
|
|
102
|
+
| `description` | `string` | no | - | Description for the text field. It will not be visible if there is an error message. | TextFieldProps |
|
|
103
|
+
| `errorMessage` | `string` | no | - | Error message for the text field | TextFieldProps |
|
|
104
|
+
| `fullWidth` | `boolean` | no | - | Ensures the input spans the full width of its parent | TextFieldProps |
|
|
105
|
+
| `label` | `string` | no | - | Label for the text field | TextFieldProps |
|
|
106
|
+
| `leadingElement` | `ReactNode` | no | `null` | Leading element for the text field | TextFieldProps |
|
|
107
|
+
| `placeholder` | `string` | no | - | Temporary text that occupies the text field when it is empty. | TextFieldProps |
|
|
108
|
+
| `size` | `"sm" \| "md" \| "lg" \| "xl"` | no | `md` | Size of the text field | TextFieldProps |
|
|
109
|
+
| `trailingElement` | `ReactNode` | no | `null` | Trailing element for the text field | TextFieldProps |
|
|
110
|
+
| `type` | `"search" \| "text" \| "tel" \| "url" \| "email" \| "password"` | no | - | The type of text-like input to render. | TextFieldProps |
|
|
111
|
+
|
|
112
|
+
## Stories
|
|
113
|
+
|
|
114
|
+
### Default
|
|
115
|
+
|
|
116
|
+
Provide a visible label and use placeholder text only as an example of the expected value. Use controlled state when product logic needs to validate, transform, save, or share the current value; use defaultValue when the field can be read from a form submit or ref.
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
const Default = () => <TextField
|
|
120
|
+
label="Customer name"
|
|
121
|
+
placeholder="Acme Co."
|
|
122
|
+
onChange={action('onChange')} />;
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### With Description
|
|
126
|
+
|
|
127
|
+
Use description text for helper content that users need before typing, such as expected format, length, or source of the value.
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
const WithDescription = () => <TextField
|
|
131
|
+
label="Invoice prefix"
|
|
132
|
+
placeholder="INV"
|
|
133
|
+
description="Use 2-5 letters that identify this invoice series."
|
|
134
|
+
onChange={action('onChange')} />;
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### With Icon
|
|
138
|
+
|
|
139
|
+
Use an icon when the field benefits from compact visual context. Keep the icon decorative unless it is exposed through an interactive element.
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
const WithIcon = () => <TextField
|
|
143
|
+
label="Signature"
|
|
144
|
+
placeholder="John Hancock"
|
|
145
|
+
onChange={action('onChange')}
|
|
146
|
+
leadingElement={<Icon variant="signature" />} />;
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### With Text
|
|
150
|
+
|
|
151
|
+
Use leading or trailing text for compact units, prefixes, suffixes, or other field-level context.
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
const WithText = () => <TextField
|
|
155
|
+
label="Price"
|
|
156
|
+
placeholder="1.00"
|
|
157
|
+
onChange={action('onChange')}
|
|
158
|
+
leadingElement={<Body size="sm">€</Body>}
|
|
159
|
+
trailingElement={<Body size="sm">EUR</Body>} />;
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Validation
|
|
163
|
+
|
|
164
|
+
Use errorMessage with isInvalid so assistive technology receives invalid state and users get actionable validation feedback.
|
|
165
|
+
|
|
166
|
+
```tsx
|
|
167
|
+
const Validation = () => <TextField
|
|
168
|
+
label="Email address"
|
|
169
|
+
placeholder="billing@example.com"
|
|
170
|
+
type="email"
|
|
171
|
+
isInvalid
|
|
172
|
+
errorMessage="Enter a valid email address."
|
|
173
|
+
onChange={action('onChange')} />;
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Disabled
|
|
177
|
+
|
|
178
|
+
Use disabled fields when the value is unavailable and users cannot act on it in the current context.
|
|
179
|
+
|
|
180
|
+
```tsx
|
|
181
|
+
const Disabled = () => <TextField label="Billing contact" placeholder="Select an account first" isDisabled />;
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Read Only
|
|
185
|
+
|
|
186
|
+
Use read-only fields when the value should remain selectable and readable but cannot be edited.
|
|
187
|
+
|
|
188
|
+
```tsx
|
|
189
|
+
const ReadOnly = () => <TextField label="Account ID" value="acct_12345" isReadOnly />;
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Sizes
|
|
193
|
+
|
|
194
|
+
Use size to match the density and prominence of the surrounding form. Use md for most forms, sm in dense interfaces, lg for prominent form rows, and xl when the label and helper or error text should feel integrated with the field.
|
|
195
|
+
|
|
196
|
+
```tsx
|
|
197
|
+
const Sizes = (args) => (
|
|
198
|
+
<Grid gap={4}>
|
|
199
|
+
{(['sm', 'md', 'lg', 'xl'] as const).map((size) => (
|
|
200
|
+
<TextField key={size} {...args} size={size} />
|
|
201
|
+
))}
|
|
202
|
+
</Grid>
|
|
203
|
+
);
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Full Width
|
|
207
|
+
|
|
208
|
+
Use fullWidth in stacked forms and responsive layouts where the field should fill the available parent width.
|
|
209
|
+
|
|
210
|
+
```tsx
|
|
211
|
+
const FullWidth = () => <TextField
|
|
212
|
+
label="Legal business name"
|
|
213
|
+
placeholder="Acme Corporation"
|
|
214
|
+
fullWidth
|
|
215
|
+
onChange={action('onChange')} />;
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### With Leading Element
|
|
219
|
+
|
|
220
|
+
Use an interactive leading element when the field needs a compact action inside the input. Match the IconButton size to the input size.
|
|
221
|
+
|
|
222
|
+
```tsx
|
|
223
|
+
const WithLeadingElement = () => <TextField
|
|
224
|
+
label="Date"
|
|
225
|
+
placeholder="mm/dd/yyyy"
|
|
226
|
+
onChange={action('onChange')}
|
|
227
|
+
leadingElement={
|
|
228
|
+
<IconButton
|
|
229
|
+
icon={<Icon variant="calendar" />}
|
|
230
|
+
variant="ghost"
|
|
231
|
+
size="sm"
|
|
232
|
+
aria-label="Select a date"
|
|
233
|
+
/>
|
|
234
|
+
} />;
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### With Trailing Element
|
|
238
|
+
|
|
239
|
+
Use an interactive trailing element when the field needs a compact action inside the input. Give the action its own accessible name.
|
|
240
|
+
|
|
241
|
+
```tsx
|
|
242
|
+
const WithTrailingElement = () => <TextField
|
|
243
|
+
label="Password"
|
|
244
|
+
type="password"
|
|
245
|
+
onChange={action('onChange')}
|
|
246
|
+
trailingElement={
|
|
247
|
+
<IconButton
|
|
248
|
+
icon={<Icon variant="eye" />}
|
|
249
|
+
variant="ghost"
|
|
250
|
+
size="sm"
|
|
251
|
+
aria-label="Show password"
|
|
252
|
+
/>
|
|
253
|
+
} />;
|
|
254
|
+
```
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Grid
|
|
2
|
+
|
|
3
|
+
## Usage Guidelines
|
|
4
|
+
|
|
5
|
+
### Overview
|
|
6
|
+
|
|
7
|
+
Grid is a layout primitive for arranging child content across rows and columns. Use it for two-dimensional layouts, and apply placement props to child Grid items when content needs to span or start and end on specific tracks.
|
|
8
|
+
|
|
9
|
+
#### When to Use
|
|
10
|
+
|
|
11
|
+
- Use Grid for two-dimensional layouts that need explicit rows and columns.
|
|
12
|
+
- Use Grid when children need to span, start, or end on specific row or column tracks.
|
|
13
|
+
- Use Grid to apply consistent gaps and alignment across a structured content area.
|
|
14
|
+
|
|
15
|
+
#### When Not to Use
|
|
16
|
+
|
|
17
|
+
- Do not use Grid for simple one-dimensional rows or stacks. Use Flex instead.
|
|
18
|
+
- Do not use Grid placement props to change the meaningful reading order of content.
|
|
19
|
+
- Do not use Grid as a replacement for semantic structure such as lists, tables, fieldsets, or navigation landmarks.
|
|
20
|
+
|
|
21
|
+
### Layout Properties
|
|
22
|
+
|
|
23
|
+
Choose explicit tracks for the container first, then add child placement only when an item needs to break out of the default flow.
|
|
24
|
+
|
|
25
|
+
| Property | Purpose | Usage notes |
|
|
26
|
+
| :----------------------------------------------- | :------------------------------------- | :------------------------------------------------------------------------------------------- |
|
|
27
|
+
| `templateColumns`, `templateRows` | Defines explicit grid tracks. | Use numbered tracks for predictable layouts, `none` to remove explicit tracks, or `subgrid`. |
|
|
28
|
+
| `gap`, `gapX`, `gapY` | Sets spacing between items. | Prefer gap utilities over child margins for consistent spacing. |
|
|
29
|
+
| `autoColumns`, `autoRows` | Sizes automatically created tracks. | Use when child placement creates implicit rows or columns. |
|
|
30
|
+
| `column`, `row` | Sets how many tracks a child spans. | Apply to child Grid items, not the parent container. |
|
|
31
|
+
| `columnStart`, `columnEnd`, `rowStart`, `rowEnd` | Places a child on specific grid lines. | Use start and end together when an item needs precise placement. |
|
|
32
|
+
| `alignItems`, `justifyContent` | Aligns items inside their grid areas. | Use for item alignment, not for changing source order or semantic grouping. |
|
|
33
|
+
| `inline` | Uses an inline-level grid container. | Use only when the grid should participate in surrounding inline flow. |
|
|
34
|
+
|
|
35
|
+
### Accessibility
|
|
36
|
+
|
|
37
|
+
- Grid uses a `div` by default and does not add interactive behavior or ARIA semantics.
|
|
38
|
+
- Preserve meaningful DOM order even when visual placement changes the rendered order.
|
|
39
|
+
- Use semantic elements inside Grid when the content is a list, form group, navigation area, table-like data, or status region.
|
|
40
|
+
- Avoid using visual placement alone to communicate relationships that need headings, labels, text, or programmatic structure.
|
|
41
|
+
- Keep focus order logical when interactive children span tracks or move across responsive layouts.
|
|
42
|
+
|
|
43
|
+
### Related
|
|
44
|
+
|
|
45
|
+
- **[Flex](components-flex.md)**: use for one-dimensional rows, stacks, wrapping groups, and proportional item sizing.
|
|
46
|
+
|
|
47
|
+
## React
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { Grid } from '@maxio-com/react-ui-components';
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Imports
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import { Grid } from "@maxio-com/react-ui-components";
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Prop Types
|
|
60
|
+
|
|
61
|
+
### Grid
|
|
62
|
+
|
|
63
|
+
| Prop | Type | Required | Default | Description | Source |
|
|
64
|
+
| --- | --- | --- | --- | --- | --- |
|
|
65
|
+
| `alignItems` | `"center" \| "start" \| "end" \| "baseline" \| "stretch"` | no | - | Apply to child Grid components. Controls how item is positioned vertically. | TypeLiteral |
|
|
66
|
+
| `autoColumns` | `"auto" \| "max" \| "min" \| "fr"` | no | - | Sets the size of columns that do not have a specified size. | TypeLiteral |
|
|
67
|
+
| `autoRows` | `"auto" \| "max" \| "min" \| "fr"` | no | - | Sets the size of rows that do not have a specified size. | TypeLiteral |
|
|
68
|
+
| `column` | `"auto" \| "full" \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 12 \| 13` | no | - | Apply to child Grid components. Sets the number of columns the item spans. Values can be overridden by `columnStart` and `columnEnd`. | TypeLiteral |
|
|
69
|
+
| `columnEnd` | `"auto" \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 12 \| 13` | no | - | Apply to child Grid components. Sets the item's ending column. Needs `columnStart` to span multiple columns. | TypeLiteral |
|
|
70
|
+
| `columnStart` | `"auto" \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 12 \| 13` | no | - | Apply to child Grid components. Sets the item's starting column. | TypeLiteral |
|
|
71
|
+
| `gap` | `0 \| 1 \| "px" \| 0.5 \| 1.5 \| 2 \| 2.5 \| 3 \| 3.5 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 12 \| 14 \| 16 \| 20 \| 24 \| 28 \| 32 \| 36 \| 40 \| 44 \| 48 \| 52 \| 56 \| 60 \| 64 \| 72 \| 80 \| 96` | no | - | Controls the vertical and horizontal space between grid items. Can be overridden by `gapX` and `gapY`. | TypeLiteral |
|
|
72
|
+
| `gapX` | `0 \| 1 \| "px" \| 0.5 \| 1.5 \| 2 \| 2.5 \| 3 \| 3.5 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 12 \| 14 \| 16 \| 20 \| 24 \| 28 \| 32 \| 36 \| 40 \| 44 \| 48 \| 52 \| 56 \| 60 \| 64 \| 72 \| 80 \| 96` | no | - | Controls the horizontal space between grid items. | TypeLiteral |
|
|
73
|
+
| `gapY` | `0 \| 1 \| "px" \| 0.5 \| 1.5 \| 2 \| 2.5 \| 3 \| 3.5 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 12 \| 14 \| 16 \| 20 \| 24 \| 28 \| 32 \| 36 \| 40 \| 44 \| 48 \| 52 \| 56 \| 60 \| 64 \| 72 \| 80 \| 96` | no | - | Controls the vertical space between grid items. | TypeLiteral |
|
|
74
|
+
| `inline` | `boolean` | no | - | Changes grid from block element to inline element. | TypeLiteral |
|
|
75
|
+
| `justifyContent` | `"center" \| "start" \| "end" \| "stretch" \| "normal" \| "between" \| "around" \| "evenly"` | no | - | Apply to child Grid components. Controls how grid item is positioned horizontally. | TypeLiteral |
|
|
76
|
+
| `row` | `"auto" \| "full" \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 12 \| 13` | no | - | Apply to child Grid components. Sets the number of rows the item spans. Values can be overridden by `rowStart` and `rowEnd`. | TypeLiteral |
|
|
77
|
+
| `rowEnd` | `"auto" \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 12 \| 13` | no | - | Apply to child Grid components. Sets the item's ending row. Needs `rowStart` to span multiple columns. | TypeLiteral |
|
|
78
|
+
| `rowStart` | `"auto" \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 12 \| 13` | no | - | Apply to child Grid components. Sets the item's starting row. | TypeLiteral |
|
|
79
|
+
| `templateColumns` | `"none" \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 12 \| "subgrid"` | no | - | Sets number of columns in the grid. | TypeLiteral |
|
|
80
|
+
| `templateRows` | `"none" \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 12 \| "subgrid"` | no | - | Sets number of rows in the grid. | TypeLiteral |
|
|
81
|
+
|
|
82
|
+
## Stories
|
|
83
|
+
|
|
84
|
+
### Grid
|
|
85
|
+
|
|
86
|
+
Use Grid for two-dimensional layouts that need explicit rows, columns, consistent gaps, or child item placement across tracks.
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
const Default = (props) => {
|
|
90
|
+
/* Disabling eslint rule to allow destructuring of props. Since these props are meant only
|
|
91
|
+
for controlling the span and position of child Grid components, they are destructured here to avoid
|
|
92
|
+
passing them to the parent Grid component in the Storybook example. */
|
|
93
|
+
|
|
94
|
+
const {
|
|
95
|
+
column,
|
|
96
|
+
columnStart,
|
|
97
|
+
columnEnd,
|
|
98
|
+
row,
|
|
99
|
+
rowStart,
|
|
100
|
+
rowEnd,
|
|
101
|
+
justifyContent,
|
|
102
|
+
alignItems,
|
|
103
|
+
...restProps
|
|
104
|
+
} = props;
|
|
105
|
+
|
|
106
|
+
const gridItemProps = {
|
|
107
|
+
justifyContent,
|
|
108
|
+
alignItems,
|
|
109
|
+
style: gridItemStyles,
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<Grid {...restProps} className="maxio-body-sm">
|
|
114
|
+
<Grid
|
|
115
|
+
key="1"
|
|
116
|
+
style={{
|
|
117
|
+
...gridItemStyles,
|
|
118
|
+
backgroundColor: '#0042FF',
|
|
119
|
+
color: 'white',
|
|
120
|
+
}}
|
|
121
|
+
justifyContent={justifyContent}
|
|
122
|
+
alignItems={alignItems}
|
|
123
|
+
column={column}
|
|
124
|
+
columnStart={columnStart}
|
|
125
|
+
columnEnd={columnEnd}
|
|
126
|
+
row={row}
|
|
127
|
+
rowStart={rowStart}
|
|
128
|
+
rowEnd={rowEnd}
|
|
129
|
+
>
|
|
130
|
+
1
|
|
131
|
+
</Grid>
|
|
132
|
+
{gridItemsArray.map((_, index) => (
|
|
133
|
+
<Grid key={index + 2} {...gridItemProps}>
|
|
134
|
+
{index + 2}
|
|
135
|
+
</Grid>
|
|
136
|
+
))}
|
|
137
|
+
</Grid>
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
```
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Icon
|
|
2
|
+
|
|
3
|
+
## Usage Guidelines
|
|
4
|
+
|
|
5
|
+
### Overview
|
|
6
|
+
|
|
7
|
+
Icon renders Maxio custom icons, approved brand icons, and supported Font Awesome fallback icons. Use icons as decorative or supporting visual cues alongside text; use IconButton when the icon itself performs an action.
|
|
8
|
+
|
|
9
|
+
#### When to Use
|
|
10
|
+
|
|
11
|
+
- Use Icon to reinforce nearby labels, statuses, navigation items, or actions with a compact visual cue.
|
|
12
|
+
- Use Maxio kit icons before reaching for Font Awesome fallback icons.
|
|
13
|
+
- Use approved brand icons when a third-party product or integration needs recognizable brand treatment.
|
|
14
|
+
- Use Icon inside components that already provide semantics, such as Button, IconButton, Link, Tag, or TextField.
|
|
15
|
+
|
|
16
|
+
#### When Not to Use
|
|
17
|
+
|
|
18
|
+
- Do not use Icon as the only label for an action. Use IconButton for icon-only controls so the accessible name is explicit.
|
|
19
|
+
- Do not use Icon for illustration, empty states, logos, or larger brand marks. Use the appropriate image or logo treatment instead.
|
|
20
|
+
- Do not override brand or duotone brand colors.
|
|
21
|
+
- Do not rely on icon shape or color alone to communicate status, severity, or required action.
|
|
22
|
+
|
|
23
|
+
### Variants
|
|
24
|
+
|
|
25
|
+
Choose the icon source before choosing size or color.
|
|
26
|
+
|
|
27
|
+
| Variants | Purpose | Usage notes |
|
|
28
|
+
| :--------------- | :------------------------------------------- | :------------------------------------------------------------------------------------- |
|
|
29
|
+
| Maxio kit | Product UI symbols maintained by Maxio. | Use first for common interface actions, statuses, and navigation. |
|
|
30
|
+
| Brand | Approved single-color brand icons. | Use only for the represented brand or integration. Brand colors are built in. |
|
|
31
|
+
| Duotone brand | Approved two-tone brand icons. | Use only for represented brands that need duotone treatment. Do not override colors. |
|
|
32
|
+
| Font Awesome | Supported fallback icons outside the kit. | Use only when no Maxio kit icon fits. Confirm the icon is available in the loaded kit. |
|
|
33
|
+
| Semantic color | Maxio icon color modifiers. | Use for status or emphasis on non-brand icons, and pair meaning with text. |
|
|
34
|
+
| `xs`, `md`, `lg` | Font Awesome size utilities exposed by Icon. | Match surrounding component density and avoid oversized standalone icons. |
|
|
35
|
+
|
|
36
|
+
### Behavior
|
|
37
|
+
|
|
38
|
+
- Icon is static visual content and does not add interaction by itself.
|
|
39
|
+
- Pair Icon with Button, IconButton, Link, or another interactive component when the surrounding pattern is interactive.
|
|
40
|
+
- The `color` prop adds a Maxio semantic color modifier to Maxio kit and Font Awesome fallback icons, but not to brand icons.
|
|
41
|
+
- The `variant` prop determines the Font Awesome class family: kit, duotone kit, or sharp regular fallback.
|
|
42
|
+
|
|
43
|
+
### Accessibility
|
|
44
|
+
|
|
45
|
+
- Treat icons as decorative when nearby visible text already communicates the same meaning.
|
|
46
|
+
- Provide visible text, a label, or surrounding semantic markup for the meaning the icon supports.
|
|
47
|
+
- Use IconButton instead of Icon when the icon alone triggers an action.
|
|
48
|
+
- Do not rely on icon color alone to communicate status or severity.
|
|
49
|
+
- Avoid standalone meaningful icons unless the surrounding component supplies an accessible name or description.
|
|
50
|
+
|
|
51
|
+
### Related
|
|
52
|
+
|
|
53
|
+
- **[IconButton](components-buttons-iconbutton.md)**: use for icon-only actions.
|
|
54
|
+
- **[Button](components-buttons-button.md)**: use for actions with visible labels and optional leading or trailing icons.
|
|
55
|
+
- **[Link](components-link.md)**: use for navigation with optional supporting icons.
|
|
56
|
+
- **[Logo](components-logo.md)**: use for Maxio brand marks.
|
|
57
|
+
|
|
58
|
+
## React
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import { Icon } from '@maxio-com/react-ui-components';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Available Icons
|
|
65
|
+
|
|
66
|
+
### Custom Maxio Icons
|
|
67
|
+
|
|
68
|
+
Use the Maxio custom icon set first for product UI. These icons render with the Font Awesome kit family.
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
<Icon variant="address-card" />
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Brand Icons
|
|
75
|
+
|
|
76
|
+
Brand icons render with their designated brand colors. Do not pass semantic color for brand icons.
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
<Icon variant="dropbox" />
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Duotone Brand Icons
|
|
83
|
+
|
|
84
|
+
Duotone brand icons render with the `fa-kit-duotone` family and approved two-color treatment. Do not override duotone brand colors.
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
<Icon variant="avalara" />
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Font Awesome Fallback Icons
|
|
91
|
+
|
|
92
|
+
If the Maxio kit does not include an appropriate icon, use a supported Font Awesome fallback icon. Fallback icons render with `fa-sharp`, `fa-regular`, and `fa-<icon-name>` classes.
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
<Icon variant="life-ring" />
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Imports
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
import { Icon } from "@maxio-com/react-ui-components";
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Prop Types
|
|
105
|
+
|
|
106
|
+
### Icon
|
|
107
|
+
|
|
108
|
+
| Prop | Type | Required | Default | Description | Source |
|
|
109
|
+
| --- | --- | --- | --- | --- | --- |
|
|
110
|
+
| `className` | `string` | no | - | Class name for the main container | TypeLiteral |
|
|
111
|
+
| `color` | `string` | no | - | The icon color | TypeLiteral |
|
|
112
|
+
| `size` | `"md" \| "lg" \| "xs"` | no | - | The icon size | TypeLiteral |
|
|
113
|
+
| `variant` | `string` | yes | - | The icon variant | TypeLiteral |
|
|
114
|
+
|
|
115
|
+
## Stories
|
|
116
|
+
|
|
117
|
+
### Custom Maxio Icon
|
|
118
|
+
|
|
119
|
+
Use a Maxio kit icon when a small visual cue reinforces nearby text, status, or navigation. Keep the icon decorative unless surrounding text supplies the accessible meaning.
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
const Default = () => <Icon variant="home" size="md" color="primary" />;
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Colored
|
|
126
|
+
|
|
127
|
+
Use semantic color when an icon needs to match nearby status, tone, or visual emphasis. Do not use color as the only way to communicate meaning.
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
const Colored = () => <Icon variant="info-circle-fill" size="md" color="info" />;
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Brand Icon
|
|
134
|
+
|
|
135
|
+
Use approved brand icons with their built-in brand colors. The color prop is intentionally ignored for brand icons.
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
const BrandIcon = () => <Icon variant={BRAND_ICONS[1]} size="md" />;
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Duotone Brand Icon
|
|
142
|
+
|
|
143
|
+
Use duotone brand icons only for brands that have an approved duotone asset. Keep the generated `fa-kit-duotone` class so Font Awesome renders both tones.
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
const DuotoneBrandIcon = () => <Icon variant={BRAND_ICONS_DUOTONE[0]} size="md" />;
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Font Awesome Icon
|
|
150
|
+
|
|
151
|
+
Use a supported Font Awesome fallback icon only when the Maxio kit does not include an appropriate icon.
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
const FontAwesomeIcon = () => <Icon variant={NON_KIT_ICONS_LIST[2]} size="md" color="secondary" />;
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Sizes
|
|
158
|
+
|
|
159
|
+
Use size to match the density of the surrounding UI. Most product interfaces should use the default surrounding component size rather than oversized icons.
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
const Sizes = (args) => (
|
|
163
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '1rem' }}>
|
|
164
|
+
{(['xs', 'md', 'lg'] as const).map((size) => (
|
|
165
|
+
<Icon key={size} {...args} size={size} />
|
|
166
|
+
))}
|
|
167
|
+
</div>
|
|
168
|
+
);
|
|
169
|
+
```
|