@maxio-com/react-ui-components 9.15.0 → 9.16.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/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 +68 -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-textfield.md +253 -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 +24 -4
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
# Drawer
|
|
2
|
+
|
|
3
|
+
## Usage Guidelines
|
|
4
|
+
|
|
5
|
+
### Overview
|
|
6
|
+
|
|
7
|
+
#### When to Use
|
|
8
|
+
|
|
9
|
+
- Use Drawer for focused tasks that need more space than a Popover, such as forms, settings, or detail views.
|
|
10
|
+
- Use Drawer when the task should temporarily block interaction with the rest of the page.
|
|
11
|
+
- Use with DialogTrigger for uncontrolled usage, or pair `open`/`onOpenChange` with your own state for controlled usage.
|
|
12
|
+
|
|
13
|
+
#### When Not to Use
|
|
14
|
+
|
|
15
|
+
- Do not use Drawer for brief explanatory content or a small set of actions. Use Popover instead.
|
|
16
|
+
- Do not use Drawer for page-level navigation. Use SideNav instead.
|
|
17
|
+
- Do not use Drawer when the task is the primary reason the user is on the page. Use a dedicated page instead.
|
|
18
|
+
|
|
19
|
+
### Behavior
|
|
20
|
+
|
|
21
|
+
- **Mouse and touch**: clicking the backdrop or the close button dismisses the drawer when `backdrop` allows it.
|
|
22
|
+
- **Keyboard**: Escape dismisses the drawer. Tab and Shift+Tab cycle focus within the drawer while it is open.
|
|
23
|
+
- **Focus management**: focus moves into the drawer on open and returns to the trigger on close, handled by the underlying React Aria `Modal`/`Dialog`.
|
|
24
|
+
- **Placement**: use `placement` to slide the drawer in from the `left`, `right`, `top`, or `bottom` edge of the viewport.
|
|
25
|
+
- **Sizing**: use `size` to control the drawer's width (left/right) or height (top/bottom); `full` spans the entire viewport dimension.
|
|
26
|
+
- **Backdrop**: use `backdrop="dim"` for a scrim behind the drawer, or `backdrop="none"` when the surrounding context should remain fully visible.
|
|
27
|
+
|
|
28
|
+
### Accessibility
|
|
29
|
+
|
|
30
|
+
- The drawer renders with `role="dialog"` and is labeled by `title` automatically via `aria-labelledby`.
|
|
31
|
+
- Always provide a `title`; it is the drawer's accessible name and its visible heading.
|
|
32
|
+
- Use `description` for supporting context below the title rather than cramming it into `title`.
|
|
33
|
+
- The close button has a built-in "Close" accessible name; do not remove it as the only dismissal path when `backdrop="none"`.
|
|
34
|
+
- Keep focus indicators visible on interactive elements inside the drawer.
|
|
35
|
+
|
|
36
|
+
### Content
|
|
37
|
+
|
|
38
|
+
- Keep `title` short and specific to the task, such as "Configure Custom Pricing" rather than "Settings".
|
|
39
|
+
- Use `description` for a single line of secondary context, such as a category or breadcrumb-style label.
|
|
40
|
+
- Put primary and secondary actions in `footer` rather than at the end of the scrollable body.
|
|
41
|
+
- Keep body content scannable; long-form content should still fit the drawer's fixed width or height.
|
|
42
|
+
|
|
43
|
+
### Related
|
|
44
|
+
|
|
45
|
+
- **[Popover](components-popover.md)**: use for lighter-weight, anchored content that doesn't need to block the page.
|
|
46
|
+
- **[Button](components-buttons-button.md)**: use for the trigger that opens the drawer and for footer actions.
|
|
47
|
+
|
|
48
|
+
## React
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
import { Drawer, DialogTrigger } from '@maxio-com/react-ui-components';
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Imports
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
import { Body, Button, DialogTrigger, Drawer } from "@maxio-com/react-ui-components";
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Prop Types
|
|
61
|
+
|
|
62
|
+
### Drawer
|
|
63
|
+
|
|
64
|
+
| Prop | Type | Required | Default | Description | Source |
|
|
65
|
+
| --- | --- | --- | --- | --- | --- |
|
|
66
|
+
| `backdrop` | `"none" \| "dim"` | no | `dim` | - | DrawerProps |
|
|
67
|
+
| `className` | `string` | no | - | - | DrawerProps |
|
|
68
|
+
| `description` | `string` | no | - | - | DrawerProps |
|
|
69
|
+
| `footer` | `ReactNode` | no | - | - | DrawerProps |
|
|
70
|
+
| `onOpenChange` | `((open: boolean) => void)` | no | - | - | DrawerProps |
|
|
71
|
+
| `open` | `boolean` | no | - | - | DrawerProps |
|
|
72
|
+
| `placement` | `"left" \| "right" \| "top" \| "bottom"` | no | `right` | - | DrawerProps |
|
|
73
|
+
| `size` | `"sm" \| "md" \| "lg" \| "xl" \| "full"` | no | `md` | - | DrawerProps |
|
|
74
|
+
| `title` | `string` | yes | - | - | DrawerProps |
|
|
75
|
+
|
|
76
|
+
## Stories
|
|
77
|
+
|
|
78
|
+
### Default
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
const Default = () => <DialogTrigger>
|
|
82
|
+
<Button variant="secondary" size="md">Open Drawer
|
|
83
|
+
</Button>
|
|
84
|
+
<Drawer placement="right" size="md" backdrop="dim" title="Drawer title">
|
|
85
|
+
<Body size="sm">{LOREM}</Body>
|
|
86
|
+
</Drawer>
|
|
87
|
+
</DialogTrigger>;
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Controlled (external state)
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
const Controlled = () => {
|
|
94
|
+
const [open, setOpen] = React.useState(false);
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<>
|
|
98
|
+
<Button variant="secondary" size="md" onClick={() => setOpen(true)}>Open Drawer
|
|
99
|
+
</Button>
|
|
100
|
+
<Drawer
|
|
101
|
+
placement="right"
|
|
102
|
+
size="md"
|
|
103
|
+
backdrop="dim"
|
|
104
|
+
title="Drawer title"
|
|
105
|
+
open={open}
|
|
106
|
+
onOpenChange={setOpen}>
|
|
107
|
+
<Body size="sm">{LOREM}</Body>
|
|
108
|
+
</Drawer>
|
|
109
|
+
</>
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### With footer
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
const WithFooter = () => {
|
|
118
|
+
const [open, setOpen] = React.useState(false);
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<>
|
|
122
|
+
<Button variant="secondary" size="md" onClick={() => setOpen(true)}>Open Drawer
|
|
123
|
+
</Button>
|
|
124
|
+
<Drawer
|
|
125
|
+
placement="right"
|
|
126
|
+
size="md"
|
|
127
|
+
backdrop="dim"
|
|
128
|
+
open={open}
|
|
129
|
+
onOpenChange={setOpen}
|
|
130
|
+
title="Settings"
|
|
131
|
+
footer={
|
|
132
|
+
<>
|
|
133
|
+
<Button
|
|
134
|
+
variant="primary"
|
|
135
|
+
size="md"
|
|
136
|
+
onClick={() => setOpen(false)}
|
|
137
|
+
>
|
|
138
|
+
Save
|
|
139
|
+
</Button>
|
|
140
|
+
<Button
|
|
141
|
+
variant="secondary"
|
|
142
|
+
size="md"
|
|
143
|
+
onClick={() => setOpen(false)}
|
|
144
|
+
>
|
|
145
|
+
Cancel
|
|
146
|
+
</Button>
|
|
147
|
+
</>
|
|
148
|
+
}>
|
|
149
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
|
|
150
|
+
{PARAGRAPHS.map((p, i) => (
|
|
151
|
+
<Body key={i} size="sm">
|
|
152
|
+
{p}
|
|
153
|
+
</Body>
|
|
154
|
+
))}
|
|
155
|
+
</div>
|
|
156
|
+
</Drawer>
|
|
157
|
+
</>
|
|
158
|
+
);
|
|
159
|
+
};
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### All sides
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
const Sides = () => {
|
|
166
|
+
const placements: DrawerPlacement[] = ['right', 'left', 'top', 'bottom'];
|
|
167
|
+
const [openPlacement, setOpenPlacement] =
|
|
168
|
+
React.useState<DrawerPlacement | null>(null);
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '0.75rem' }}>
|
|
172
|
+
{placements.map((placement) => (
|
|
173
|
+
<Button
|
|
174
|
+
key={placement}
|
|
175
|
+
variant="secondary"
|
|
176
|
+
size="md"
|
|
177
|
+
onClick={() => setOpenPlacement(placement)}
|
|
178
|
+
>
|
|
179
|
+
{placement}
|
|
180
|
+
</Button>
|
|
181
|
+
))}
|
|
182
|
+
{placements.map((placement) => (
|
|
183
|
+
<Drawer
|
|
184
|
+
key={placement}
|
|
185
|
+
open={openPlacement === placement}
|
|
186
|
+
onOpenChange={(o) => !o && setOpenPlacement(null)}
|
|
187
|
+
placement={placement}
|
|
188
|
+
size="md"
|
|
189
|
+
title={`${placement} drawer`}
|
|
190
|
+
>
|
|
191
|
+
<Body size="sm">Slides in from the {placement}.</Body>
|
|
192
|
+
</Drawer>
|
|
193
|
+
))}
|
|
194
|
+
</div>
|
|
195
|
+
);
|
|
196
|
+
};
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Backdrop variants
|
|
200
|
+
|
|
201
|
+
```tsx
|
|
202
|
+
const BackdropVariants = () => {
|
|
203
|
+
const backdrops: DrawerBackdrop[] = ['dim', 'none'];
|
|
204
|
+
const [openBackdrop, setOpenBackdrop] =
|
|
205
|
+
React.useState<DrawerBackdrop | null>(null);
|
|
206
|
+
|
|
207
|
+
return (
|
|
208
|
+
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '0.75rem' }}>
|
|
209
|
+
{backdrops.map((b) => (
|
|
210
|
+
<Button
|
|
211
|
+
key={b}
|
|
212
|
+
variant="secondary"
|
|
213
|
+
size="md"
|
|
214
|
+
onClick={() => setOpenBackdrop(b)}
|
|
215
|
+
>
|
|
216
|
+
{b}
|
|
217
|
+
</Button>
|
|
218
|
+
))}
|
|
219
|
+
{backdrops.map((b) => (
|
|
220
|
+
<Drawer
|
|
221
|
+
key={b}
|
|
222
|
+
open={openBackdrop === b}
|
|
223
|
+
onOpenChange={(o) => !o && setOpenBackdrop(null)}
|
|
224
|
+
backdrop={b}
|
|
225
|
+
title={`backdrop="${b}"`}
|
|
226
|
+
>
|
|
227
|
+
<Body size="sm">Backdrop style: {b}</Body>
|
|
228
|
+
</Drawer>
|
|
229
|
+
))}
|
|
230
|
+
</div>
|
|
231
|
+
);
|
|
232
|
+
};
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Sizes
|
|
236
|
+
|
|
237
|
+
```tsx
|
|
238
|
+
const Sizes = () => {
|
|
239
|
+
const sizes: DrawerSize[] = ['sm', 'md', 'lg', 'xl', 'full'];
|
|
240
|
+
const [openSize, setOpenSize] = React.useState<DrawerSize | null>(null);
|
|
241
|
+
|
|
242
|
+
return (
|
|
243
|
+
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '0.75rem' }}>
|
|
244
|
+
{sizes.map((s) => (
|
|
245
|
+
<Button
|
|
246
|
+
key={s}
|
|
247
|
+
variant="secondary"
|
|
248
|
+
size="md"
|
|
249
|
+
onClick={() => setOpenSize(s)}
|
|
250
|
+
>
|
|
251
|
+
{s}
|
|
252
|
+
</Button>
|
|
253
|
+
))}
|
|
254
|
+
{sizes.map((s) => (
|
|
255
|
+
<Drawer
|
|
256
|
+
key={s}
|
|
257
|
+
open={openSize === s}
|
|
258
|
+
onOpenChange={(o) => !o && setOpenSize(null)}
|
|
259
|
+
size={s}
|
|
260
|
+
title={`size="${s}"`}
|
|
261
|
+
>
|
|
262
|
+
<Body size="sm">Width: {s}</Body>
|
|
263
|
+
</Drawer>
|
|
264
|
+
))}
|
|
265
|
+
</div>
|
|
266
|
+
);
|
|
267
|
+
};
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### With description
|
|
271
|
+
|
|
272
|
+
```tsx
|
|
273
|
+
const WithDescription = () => {
|
|
274
|
+
const [open, setOpen] = React.useState(false);
|
|
275
|
+
|
|
276
|
+
return (
|
|
277
|
+
<>
|
|
278
|
+
<Button variant="secondary" size="md" onClick={() => setOpen(true)}>Open Drawer
|
|
279
|
+
</Button>
|
|
280
|
+
<Drawer
|
|
281
|
+
placement="right"
|
|
282
|
+
size="md"
|
|
283
|
+
backdrop="dim"
|
|
284
|
+
open={open}
|
|
285
|
+
onOpenChange={setOpen}
|
|
286
|
+
title="Configure Custom Pricing"
|
|
287
|
+
description="API Credits · Product">
|
|
288
|
+
<Body size="sm">{LOREM}</Body>
|
|
289
|
+
</Drawer>
|
|
290
|
+
</>
|
|
291
|
+
);
|
|
292
|
+
};
|
|
293
|
+
```
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# Flex
|
|
2
|
+
|
|
3
|
+
## Usage Guidelines
|
|
4
|
+
|
|
5
|
+
### Overview
|
|
6
|
+
|
|
7
|
+
Flex is a layout primitive for arranging child content along a single axis, with optional wrapping, spacing, alignment, and item sizing.
|
|
8
|
+
|
|
9
|
+
#### When to Use
|
|
10
|
+
|
|
11
|
+
- Use Flex for one-dimensional layout where children flow in a row or column.
|
|
12
|
+
- Use Flex to apply consistent gaps, alignment, wrapping, and item sizing to a small group of related elements.
|
|
13
|
+
- Use Flex when the layout should adapt to available space without introducing grid tracks.
|
|
14
|
+
|
|
15
|
+
#### When Not to Use
|
|
16
|
+
|
|
17
|
+
- Do not use Flex for two-dimensional layouts that need explicit rows and columns. Use Grid instead.
|
|
18
|
+
- Do not use reverse directions to change meaningful reading order. Keep important content order correct in the DOM.
|
|
19
|
+
- Do not use Flex as a spacing wrapper when semantic grouping, list markup, or a component-specific layout is more appropriate.
|
|
20
|
+
|
|
21
|
+
### Layout Properties
|
|
22
|
+
|
|
23
|
+
Choose the smallest set of flex utilities needed for the layout.
|
|
24
|
+
|
|
25
|
+
| Property | Purpose | Usage notes |
|
|
26
|
+
| :-------------------------------- | :---------------------------------- | :----------------------------------------------------------------------------- |
|
|
27
|
+
| `flexDirection` | Sets the main axis. | Use `row` for inline groups and `col` for stacked content. |
|
|
28
|
+
| `wrap` | Allows items to continue on rows. | Pair with predictable item widths or `basis` values. |
|
|
29
|
+
| `gap`, `gapX`, `gapY` | Sets spacing between items. | Prefer gap utilities over item margins for consistent spacing. |
|
|
30
|
+
| `alignItems` | Aligns items on the cross axis. | Use `center` for mixed-size inline content and `stretch` for equal heights. |
|
|
31
|
+
| `justifyContent` | Distributes items on the main axis. | Use `between`, `around`, or `evenly` only when the empty space is intentional. |
|
|
32
|
+
| `basis`, `flex`, `grow`, `shrink` | Controls item sizing. | Apply item sizing to children, not the parent container. |
|
|
33
|
+
|
|
34
|
+
### Accessibility
|
|
35
|
+
|
|
36
|
+
- Flex uses a `div` by default and does not add interactive behavior or ARIA semantics.
|
|
37
|
+
- Preserve meaningful DOM order, especially when using `row-reverse` or `col-reverse`.
|
|
38
|
+
- Use semantic elements inside Flex when the content is a list, navigation, form group, toolbar, or status region.
|
|
39
|
+
- Avoid using visual alignment alone to communicate relationships that need text, headings, labels, or programmatic structure.
|
|
40
|
+
- Keep focus order logical when interactive children wrap or resize across breakpoints.
|
|
41
|
+
|
|
42
|
+
### Related
|
|
43
|
+
|
|
44
|
+
- **[Grid](components-grid.md)**: use for two-dimensional layouts with explicit rows, columns, or item placement.
|
|
45
|
+
|
|
46
|
+
## React
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import { Flex } from '@maxio-com/react-ui-components';
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Imports
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import { Flex } from "@maxio-com/react-ui-components";
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Prop Types
|
|
59
|
+
|
|
60
|
+
### Flex
|
|
61
|
+
|
|
62
|
+
| Prop | Type | Required | Default | Description | Source |
|
|
63
|
+
| --- | --- | --- | --- | --- | --- |
|
|
64
|
+
| `alignItems` | `"center" \| "start" \| "end" \| "baseline" \| "stretch"` | no | - | Controls how flex items are positioned along the main axis (defined by `FlexDirection`). Items will stretch by default if no value is set. | TypeLiteral |
|
|
65
|
+
| `basis` | `"auto" \| "1/2" \| "1/3" \| "2/3" \| "1/4" \| "2/4" \| "3/4" \| "1/5" \| "2/5" \| "3/5" \| "4/5" \| "1/6" \| "2/6" \| "3/6" \| "4/6" \| "5/6" \| "1/12" \| "2/12" \| "3/12" \| "4/12" \| "5/12" \| "6/12" \| "7/12" \| "8/12" \| "9/12" \| "10/12" \| "11/12" \| "full"` | no | - | Defines the initial size of flex items. | TypeLiteral |
|
|
66
|
+
| `children` | `ReactNode` | no | - | The content of the flex container. Can be any valid `ReactNode`. | TypeLiteral, DOMAttributes |
|
|
67
|
+
| `className` | `string` | no | - | Additional class names for custom styling. | TypeLiteral, HTMLAttributes |
|
|
68
|
+
| `flex` | `"none" \| "auto" \| "initial" \| 1` | no | - | Controls how flex items both grow and shrink. | TypeLiteral |
|
|
69
|
+
| `flexDirection` | `"row" \| "col" \| "row-reverse" \| "col-reverse"` | no | - | Defines the flex direction. Default orientation is `row`. | TypeLiteral |
|
|
70
|
+
| `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 flex items. | TypeLiteral |
|
|
71
|
+
| `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 flex items. | TypeLiteral |
|
|
72
|
+
| `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 flex items. | TypeLiteral |
|
|
73
|
+
| `grow` | `boolean` | no | - | Allows or restricts growing. | TypeLiteral |
|
|
74
|
+
| `justifyContent` | `"center" \| "start" \| "end" \| "stretch" \| "normal" \| "between" \| "around" \| "evenly"` | no | - | Controls how flex items are positioned along the main axis (defined by `FlexDirection`). | TypeLiteral |
|
|
75
|
+
| `shrink` | `boolean` | no | - | Allows or restricts shrinking. | TypeLiteral |
|
|
76
|
+
| `wrap` | `"wrap" \| "nowrap" \| "wrap-reverse"` | no | - | Controls whether the flex items are forced onto one line or can wrap onto multiple lines. | TypeLiteral |
|
|
77
|
+
|
|
78
|
+
## Stories
|
|
79
|
+
|
|
80
|
+
### Flex
|
|
81
|
+
|
|
82
|
+
Use Flex for one-dimensional layout when child items need shared direction, spacing, alignment, wrapping, or proportional sizing.
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
const Default = (props) => (
|
|
86
|
+
<Flex
|
|
87
|
+
flexDirection={props.flexDirection}
|
|
88
|
+
gap={props.gap}
|
|
89
|
+
alignItems={props.alignItems}
|
|
90
|
+
justifyContent={props.justifyContent}
|
|
91
|
+
wrap={props.wrap}
|
|
92
|
+
style={container}
|
|
93
|
+
gapX={props.gapX}
|
|
94
|
+
gapY={props.gapY}
|
|
95
|
+
className={'maxio-body-sm'}
|
|
96
|
+
>
|
|
97
|
+
<>
|
|
98
|
+
<Flex
|
|
99
|
+
key="1"
|
|
100
|
+
flex={props.flex}
|
|
101
|
+
basis={props.basis}
|
|
102
|
+
shrink={props.shrink}
|
|
103
|
+
grow={props.grow}
|
|
104
|
+
style={blueSquare}
|
|
105
|
+
>
|
|
106
|
+
01
|
|
107
|
+
</Flex>
|
|
108
|
+
<Flex
|
|
109
|
+
key="2"
|
|
110
|
+
flex={props.flex}
|
|
111
|
+
basis={props.basis}
|
|
112
|
+
shrink={props.shrink}
|
|
113
|
+
style={purpleSquare}
|
|
114
|
+
>
|
|
115
|
+
02
|
|
116
|
+
</Flex>
|
|
117
|
+
<Flex
|
|
118
|
+
key="3"
|
|
119
|
+
flex={props.flex}
|
|
120
|
+
basis={props.basis}
|
|
121
|
+
shrink={props.shrink}
|
|
122
|
+
style={pinkSquare}
|
|
123
|
+
>
|
|
124
|
+
03
|
|
125
|
+
</Flex>
|
|
126
|
+
</>
|
|
127
|
+
</Flex>
|
|
128
|
+
);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Basis
|
|
132
|
+
|
|
133
|
+
Use basis values when sibling items need predictable initial widths before available space is distributed.
|
|
134
|
+
|
|
135
|
+
```tsx
|
|
136
|
+
const Basis = (props) => <Flex {...props}>{props.children}</Flex>;
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Row Reverse
|
|
140
|
+
|
|
141
|
+
Use row-reverse only when the visual order should be reversed while the source order remains unchanged for reading and assistive technology.
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
const RowReverse = (props) => <Flex {...props}>{props.children}</Flex>;
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Column Reverse
|
|
148
|
+
|
|
149
|
+
Use column-reverse sparingly because it changes visual order without changing DOM order.
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
const ColumnReverse = (props) => <Flex {...props}>{props.children}</Flex>;
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Wrap reverse
|
|
156
|
+
|
|
157
|
+
Use wrap-reverse only when additional rows should stack in the opposite cross-axis direction.
|
|
158
|
+
|
|
159
|
+
```tsx
|
|
160
|
+
const WrapReverse = (props) => <Flex {...props}>{props.children}</Flex>;
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Wrap
|
|
164
|
+
|
|
165
|
+
Use wrapping when items may exceed the available inline space and should continue on additional rows instead of overflowing.
|
|
166
|
+
|
|
167
|
+
```tsx
|
|
168
|
+
const Wrap = (props) => <Flex {...props}>{props.children}</Flex>;
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Grow
|
|
172
|
+
|
|
173
|
+
Use grow when one or more items should absorb remaining space while fixed siblings keep their initial size.
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
const Grow = (props) => <Flex {...props}>{props.children}</Flex>;
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Shrink
|
|
180
|
+
|
|
181
|
+
Use shrink when an item may reduce in size to keep the row within its container.
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
const Shrink = (props) => <Flex {...props}>{props.children}</Flex>;
|
|
185
|
+
```
|