@instructure/ui-flex 11.6.0 → 11.6.1-snapshot-129

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.
Files changed (89) hide show
  1. package/CHANGELOG.md +30 -281
  2. package/es/Flex/{Item → v1/Item}/index.js +2 -2
  3. package/es/Flex/{index.js → v1/index.js} +2 -2
  4. package/es/Flex/v2/Item/index.js +97 -0
  5. package/es/Flex/v2/Item/props.js +26 -0
  6. package/es/Flex/v2/Item/styles.js +68 -0
  7. package/es/Flex/v2/index.js +119 -0
  8. package/es/Flex/v2/props.js +26 -0
  9. package/es/Flex/v2/styles.js +101 -0
  10. package/es/{index.js → exports/a.js} +1 -1
  11. package/{src/index.ts → es/exports/b.js} +1 -5
  12. package/lib/Flex/{Item → v1/Item}/index.js +3 -3
  13. package/lib/Flex/v1/index.js +135 -0
  14. package/lib/Flex/v2/Item/index.js +102 -0
  15. package/lib/Flex/v2/Item/props.js +31 -0
  16. package/lib/Flex/v2/Item/styles.js +74 -0
  17. package/lib/Flex/{index.js → v2/index.js} +3 -4
  18. package/lib/Flex/v2/props.js +31 -0
  19. package/lib/Flex/v2/styles.js +107 -0
  20. package/lib/{index.js → exports/a.js} +3 -3
  21. package/lib/exports/b.js +18 -0
  22. package/package.json +38 -16
  23. package/src/Flex/{Item → v1/Item}/index.tsx +2 -2
  24. package/src/Flex/{index.tsx → v1/index.tsx} +2 -2
  25. package/src/Flex/v2/Item/index.tsx +115 -0
  26. package/src/Flex/v2/Item/props.ts +146 -0
  27. package/src/Flex/v2/Item/styles.ts +66 -0
  28. package/src/Flex/v2/README.md +419 -0
  29. package/src/Flex/v2/index.tsx +157 -0
  30. package/src/Flex/v2/props.ts +152 -0
  31. package/src/Flex/v2/styles.ts +112 -0
  32. package/src/exports/a.ts +28 -0
  33. package/src/exports/b.ts +28 -0
  34. package/tsconfig.build.tsbuildinfo +1 -1
  35. package/types/Flex/v1/Item/index.d.ts.map +1 -0
  36. package/types/Flex/v1/Item/props.d.ts.map +1 -0
  37. package/types/Flex/v1/Item/styles.d.ts.map +1 -0
  38. package/types/Flex/v1/index.d.ts.map +1 -0
  39. package/types/Flex/v1/props.d.ts.map +1 -0
  40. package/types/Flex/v1/styles.d.ts.map +1 -0
  41. package/types/Flex/v1/theme.d.ts.map +1 -0
  42. package/types/Flex/v2/Item/index.d.ts +41 -0
  43. package/types/Flex/v2/Item/index.d.ts.map +1 -0
  44. package/types/Flex/v2/Item/props.d.ts +79 -0
  45. package/types/Flex/v2/Item/props.d.ts.map +1 -0
  46. package/types/Flex/v2/Item/styles.d.ts +14 -0
  47. package/types/Flex/v2/Item/styles.d.ts.map +1 -0
  48. package/types/Flex/v2/index.d.ts +49 -0
  49. package/types/Flex/v2/index.d.ts.map +1 -0
  50. package/types/Flex/v2/props.d.ts +83 -0
  51. package/types/Flex/v2/props.d.ts.map +1 -0
  52. package/types/Flex/v2/styles.d.ts +19 -0
  53. package/types/Flex/v2/styles.d.ts.map +1 -0
  54. package/types/exports/a.d.ts +4 -0
  55. package/types/exports/a.d.ts.map +1 -0
  56. package/types/exports/b.d.ts +4 -0
  57. package/types/exports/b.d.ts.map +1 -0
  58. package/types/Flex/Item/index.d.ts.map +0 -1
  59. package/types/Flex/Item/props.d.ts.map +0 -1
  60. package/types/Flex/Item/styles.d.ts.map +0 -1
  61. package/types/Flex/index.d.ts.map +0 -1
  62. package/types/Flex/props.d.ts.map +0 -1
  63. package/types/Flex/styles.d.ts.map +0 -1
  64. package/types/Flex/theme.d.ts.map +0 -1
  65. package/types/index.d.ts +0 -4
  66. package/types/index.d.ts.map +0 -1
  67. /package/es/Flex/{Item → v1/Item}/props.js +0 -0
  68. /package/es/Flex/{Item → v1/Item}/styles.js +0 -0
  69. /package/es/Flex/{props.js → v1/props.js} +0 -0
  70. /package/es/Flex/{styles.js → v1/styles.js} +0 -0
  71. /package/es/Flex/{theme.js → v1/theme.js} +0 -0
  72. /package/lib/Flex/{Item → v1/Item}/props.js +0 -0
  73. /package/lib/Flex/{Item → v1/Item}/styles.js +0 -0
  74. /package/lib/Flex/{props.js → v1/props.js} +0 -0
  75. /package/lib/Flex/{styles.js → v1/styles.js} +0 -0
  76. /package/lib/Flex/{theme.js → v1/theme.js} +0 -0
  77. /package/src/Flex/{Item → v1/Item}/props.ts +0 -0
  78. /package/src/Flex/{Item → v1/Item}/styles.ts +0 -0
  79. /package/src/Flex/{README.md → v1/README.md} +0 -0
  80. /package/src/Flex/{props.ts → v1/props.ts} +0 -0
  81. /package/src/Flex/{styles.ts → v1/styles.ts} +0 -0
  82. /package/src/Flex/{theme.ts → v1/theme.ts} +0 -0
  83. /package/types/Flex/{Item → v1/Item}/index.d.ts +0 -0
  84. /package/types/Flex/{Item → v1/Item}/props.d.ts +0 -0
  85. /package/types/Flex/{Item → v1/Item}/styles.d.ts +0 -0
  86. /package/types/Flex/{index.d.ts → v1/index.d.ts} +0 -0
  87. /package/types/Flex/{props.d.ts → v1/props.d.ts} +0 -0
  88. /package/types/Flex/{styles.d.ts → v1/styles.d.ts} +0 -0
  89. /package/types/Flex/{theme.d.ts → v1/theme.d.ts} +0 -0
@@ -0,0 +1,146 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import React from 'react'
26
+ import type {
27
+ AsElementType,
28
+ OtherHTMLAttributes
29
+ } from '@instructure/shared-types'
30
+ import type {
31
+ Spacing,
32
+ WithStyleProps,
33
+ ComponentStyle
34
+ } from '@instructure/emotion'
35
+
36
+ type FlexItemOwnProps = {
37
+ /**
38
+ * The children to render inside the Item
39
+ */
40
+ children?: React.ReactNode
41
+
42
+ /**
43
+ * the element type to render as
44
+ */
45
+ as?: AsElementType
46
+
47
+ /**
48
+ * provides a reference to the underlying html root element
49
+ */
50
+ elementRef?: (element: Element | null) => void
51
+
52
+ /**
53
+ * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
54
+ * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
55
+ * familiar CSS-like shorthand. For example: `margin="small auto large"`.
56
+ */
57
+ margin?: Spacing
58
+
59
+ /**
60
+ * Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
61
+ * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
62
+ * familiar CSS-like shorthand. For example: `padding="small x-large large"`.
63
+ */
64
+ padding?: Spacing
65
+
66
+ /**
67
+ * overrides the parent Flex's alignItems prop, if needed
68
+ */
69
+ align?: 'center' | 'start' | 'end' | 'stretch'
70
+
71
+ /**
72
+ * Inherits from the parent Flex component
73
+ */
74
+ direction?: 'row' | 'column'
75
+
76
+ /**
77
+ * Designates the text alignment inside the Item
78
+ */
79
+ textAlign?: 'start' | 'center' | 'end'
80
+
81
+ /**
82
+ * Handles horizontal overflow
83
+ */
84
+ overflowX?: 'auto' | 'hidden' | 'visible'
85
+
86
+ /**
87
+ * Handles vertical overflow
88
+ */
89
+ overflowY?: 'auto' | 'hidden' | 'visible'
90
+
91
+ /**
92
+ * Should the FlexItem grow to fill any available space?
93
+ */
94
+ shouldGrow?: boolean
95
+
96
+ /**
97
+ * Should the FlexItem shrink (stopping at its `size`)?
98
+ */
99
+ shouldShrink?: boolean
100
+
101
+ /**
102
+ * Sets the base size of the FlexItem (width if direction is `row`; height if direction is `column`)
103
+ */
104
+ size?: string
105
+
106
+ /**
107
+ * Places dashed lines around the component's borders to help debug your layout
108
+ */
109
+ withVisualDebug?: boolean
110
+ /**
111
+ * Specifies the order of the `Flex.Item` inside the `Flex` component.
112
+ *
113
+ * Utilizes the order flex CSS property.
114
+ */
115
+ order?: number
116
+ }
117
+
118
+ type PropKeys = keyof FlexItemOwnProps
119
+
120
+ type AllowedPropKeys = Readonly<Array<PropKeys>>
121
+
122
+ type FlexItemProps = FlexItemOwnProps &
123
+ WithStyleProps<null, FlexItemStyle> &
124
+ OtherHTMLAttributes<FlexItemOwnProps>
125
+
126
+ type FlexItemStyle = ComponentStyle<'flexItem'>
127
+ const allowedProps: AllowedPropKeys = [
128
+ 'children',
129
+ 'as',
130
+ 'elementRef',
131
+ 'margin',
132
+ 'padding',
133
+ 'align',
134
+ 'direction',
135
+ 'textAlign',
136
+ 'overflowX',
137
+ 'overflowY',
138
+ 'shouldGrow',
139
+ 'shouldShrink',
140
+ 'size',
141
+ 'withVisualDebug',
142
+ 'order'
143
+ ]
144
+
145
+ export type { FlexItemProps, FlexItemStyle }
146
+ export { allowedProps }
@@ -0,0 +1,66 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import type { FlexItemProps, FlexItemStyle } from './props'
26
+
27
+ /**
28
+ * ---
29
+ * private: true
30
+ * ---
31
+ * Generates the style object from the theme and provided additional information
32
+ * @param {Object} componentTheme The theme variable object.
33
+ * @param {Object} props the props of the component, the style is applied to
34
+ * @param {Object} state the state of the component, the style is applied to
35
+ * @return {Object} The final style object, which will be used in the component
36
+ */
37
+ const generateStyle = (
38
+ _componentTheme: null,
39
+ props: FlexItemProps
40
+ ): FlexItemStyle => {
41
+ const { shouldGrow, shouldShrink, align, size, order } = props
42
+
43
+ const alignSelfValues = {
44
+ start: 'flex-start',
45
+ end: 'flex-end',
46
+ center: 'center',
47
+ stretch: 'stretch'
48
+ }
49
+
50
+ return {
51
+ flexItem: {
52
+ label: 'flexItem',
53
+ boxSizing: 'border-box',
54
+ minWidth: '0.0625rem',
55
+ flexBasis: size,
56
+ ...(order !== undefined ? { order } : {}),
57
+ // initial value is 1, but we want 0 as our default,
58
+ // so users can opt in to shrink like they do grow
59
+ flexShrink: shouldShrink ? 1 : 0,
60
+ ...(shouldGrow && { flexGrow: 1 }),
61
+ ...(align && { alignSelf: alignSelfValues[align] })
62
+ }
63
+ }
64
+ }
65
+
66
+ export default generateStyle
@@ -0,0 +1,419 @@
1
+ ---
2
+ describes: Flex
3
+ ---
4
+
5
+ The Flex component makes it simple for developers to create multi-column
6
+ layouts with flexbox.
7
+
8
+ ### Layout direction
9
+
10
+ **Note:** Use the `withVisualDebug` property to see the borders of Flex/Flex.Item while developing!
11
+
12
+ Flex defaults to a `direction` of `row`, creating a horizontal layout. Change `direction` to
13
+ `column` to stack your Flex.Items.
14
+
15
+ > **Unless your layout has a specific/finite height, you probably don't need `direction="column"`.** To create a layout of stacked elements, it is simpler to use multiple [View](View) components with `display="block"`.
16
+
17
+ ```js
18
+ ---
19
+ type: example
20
+ ---
21
+ <div>
22
+ <Flex withVisualDebug margin="none none large">
23
+ <Flex.Item>One</Flex.Item>
24
+ <Flex.Item>Two</Flex.Item>
25
+ <Flex.Item>Three</Flex.Item>
26
+ <Flex.Item>Four</Flex.Item>
27
+ </Flex>
28
+ <Flex withVisualDebug direction="column" margin="none none large">
29
+ <Flex.Item>One</Flex.Item>
30
+ <Flex.Item>Two</Flex.Item>
31
+ <Flex.Item>Three</Flex.Item>
32
+ <Flex.Item>Four</Flex.Item>
33
+ </Flex>
34
+ <Flex withVisualDebug direction="row-reverse" margin="none none large">
35
+ <Flex.Item>One</Flex.Item>
36
+ <Flex.Item>Two</Flex.Item>
37
+ <Flex.Item>Three</Flex.Item>
38
+ <Flex.Item>Four</Flex.Item>
39
+ </Flex>
40
+ <Flex withVisualDebug direction="column-reverse">
41
+ <Flex.Item>One</Flex.Item>
42
+ <Flex.Item>Two</Flex.Item>
43
+ <Flex.Item>Three</Flex.Item>
44
+ <Flex.Item>Four</Flex.Item>
45
+ </Flex>
46
+ </div>
47
+ ```
48
+
49
+ ### Gap between Flex.Items
50
+
51
+ Flex items will have no gap by default. You can set the gap between Flex.Items by using the `gap` property.
52
+
53
+ ```js
54
+ ---
55
+ type: example
56
+ ---
57
+ <div>
58
+ <Flex withVisualDebug margin="none none large" gap="small">
59
+ <Flex.Item>One</Flex.Item>
60
+ <Flex.Item>Two</Flex.Item>
61
+ <Flex.Item>Three</Flex.Item>
62
+ <Flex.Item>Four</Flex.Item>
63
+ </Flex>
64
+ <Flex withVisualDebug direction="column" margin="none none large" gap="medium">
65
+ <Flex.Item>One</Flex.Item>
66
+ <Flex.Item>Two</Flex.Item>
67
+ <Flex.Item>Three</Flex.Item>
68
+ <Flex.Item>Four</Flex.Item>
69
+ </Flex>
70
+ <Flex withVisualDebug direction="row-reverse" margin="none none large" gap="medium">
71
+ <Flex.Item>One</Flex.Item>
72
+ <Flex.Item>Two</Flex.Item>
73
+ <Flex.Item>Three</Flex.Item>
74
+ <Flex.Item>Four</Flex.Item>
75
+ </Flex>
76
+ <Flex withVisualDebug direction="column-reverse" gap="small">
77
+ <Flex.Item>One</Flex.Item>
78
+ <Flex.Item>Two</Flex.Item>
79
+ <Flex.Item>Three</Flex.Item>
80
+ <Flex.Item>Four</Flex.Item>
81
+ </Flex>
82
+ </div>
83
+ ```
84
+
85
+ You can also set the gap between rows and columns by using the `gap` property. Make sure that the `wrap` property is set to `wrap` or `wrap-reverse`.
86
+
87
+ ```js
88
+ ---
89
+ type: example
90
+ ---
91
+ <div>
92
+ <Flex withVisualDebug margin="none none large" gap="small" wrap="wrap">
93
+ <Flex.Item size='25rem'>One</Flex.Item>
94
+ <Flex.Item size='25rem'>Two</Flex.Item>
95
+ <Flex.Item size='25rem'>Three</Flex.Item>
96
+ <Flex.Item size='25rem'>Four</Flex.Item>
97
+ </Flex>
98
+ <Flex withVisualDebug margin="none none large" gap="small large" wrap="wrap">
99
+ <Flex.Item size='25rem'>One</Flex.Item>
100
+ <Flex.Item size='25rem'>Two</Flex.Item>
101
+ <Flex.Item size='25rem'>Three</Flex.Item>
102
+ <Flex.Item size='25rem'>Four</Flex.Item>
103
+ </Flex>
104
+ <Flex withVisualDebug margin="none none large" gap="small" wrap="wrap-reverse">
105
+ <Flex.Item size='25rem'>One</Flex.Item>
106
+ <Flex.Item size='25rem'>Two</Flex.Item>
107
+ <Flex.Item size='25rem'>Three</Flex.Item>
108
+ <Flex.Item size='25rem'>Four</Flex.Item>
109
+ </Flex>
110
+ <Flex withVisualDebug margin="none none large" gap="small large" wrap="wrap-reverse">
111
+ <Flex.Item size='25rem'>One</Flex.Item>
112
+ <Flex.Item size='25rem'>Two</Flex.Item>
113
+ <Flex.Item size='25rem'>Three</Flex.Item>
114
+ <Flex.Item size='25rem'>Four</Flex.Item>
115
+ </Flex>
116
+ </div>
117
+ ```
118
+
119
+ ### Sizing Flex.Items
120
+
121
+ By default, Flex.Items **expand to fit their contents**, even if that means overflowing
122
+ their container.
123
+
124
+ ```js
125
+ ---
126
+ type: example
127
+ ---
128
+ <Flex withVisualDebug>
129
+ <Flex.Item padding="x-small">
130
+ Villum dolore eu fugiat nulla pariatur.
131
+ </Flex.Item>
132
+ <Flex.Item padding="x-small">
133
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit.
134
+ </Flex.Item>
135
+ <Flex.Item padding="x-small">
136
+ Duis aute irure.
137
+ </Flex.Item>
138
+ <Flex.Item padding="x-small">
139
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
140
+ </Flex.Item>
141
+ </Flex>
142
+ ```
143
+
144
+ Adding the `shouldShrink` property forces the Flex.Item to shrink as needed to fit inside its
145
+ container.
146
+
147
+ ```js
148
+ ---
149
+ type: example
150
+ ---
151
+ <Flex withVisualDebug>
152
+ <Flex.Item padding="x-small" shouldShrink>
153
+ Villum dolore eu fugiat nulla pariatur.
154
+ </Flex.Item>
155
+ <Flex.Item padding="x-small" shouldShrink>
156
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit.
157
+ </Flex.Item>
158
+ <Flex.Item padding="x-small" shouldShrink>
159
+ Duis aute irure.
160
+ </Flex.Item>
161
+ <Flex.Item padding="x-small" shouldShrink>
162
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
163
+ </Flex.Item>
164
+ </Flex>
165
+ ```
166
+
167
+ The `shouldGrow` property forces the Flex.Item to expand to fill in any available space.
168
+
169
+ ```js
170
+ ---
171
+ type: example
172
+ ---
173
+ <Flex withVisualDebug>
174
+ <Flex.Item padding="x-small" shouldShrink shouldGrow>
175
+ I am growing and shrinking!
176
+ </Flex.Item>
177
+ <Flex.Item>
178
+ I am not shrinking or growing.
179
+ </Flex.Item>
180
+ </Flex>
181
+ ```
182
+
183
+ The `size` property sets the base size (accepts px, em, rem) for the Flex.Item. If the
184
+ `direction` property is `row`, this is the item's **width**. If `direction` is `column`,
185
+ then it is the item's **height**. Flex.Items can grow beyond their `size`, but cannot
186
+ shrink to less than their `size`.
187
+
188
+ ```js
189
+ ---
190
+ type: example
191
+ ---
192
+ <Flex withVisualDebug>
193
+ <Flex.Item padding="x-small" size="200px">
194
+ I am always 200px.
195
+ </Flex.Item>
196
+ <Flex.Item padding="x-small" shouldShrink shouldGrow size="200px">
197
+ I can grow, and shrink down to 200px.
198
+ </Flex.Item>
199
+ <Flex.Item padding="x-small" size="25%">
200
+ I am always 25%.
201
+ </Flex.Item>
202
+ </Flex>
203
+ ```
204
+
205
+ ### Aligning Flex.Items
206
+
207
+ By default, Flex aligns its Flex.Items along the `center` of the axis. Use the `alignItems`
208
+ property to change this behavior.
209
+
210
+ `alignItems` can be overridden on individual Flex.Items through Flex.Item's `align` property.
211
+
212
+ ```js
213
+ ---
214
+ type: example
215
+ ---
216
+ <Flex alignItems="end" withVisualDebug>
217
+ <Flex.Item>
218
+ <Avatar name="Sarah Robinson" size="large" src={avatarSquare} />
219
+ </Flex.Item>
220
+ <Flex.Item shouldGrow shouldShrink>
221
+ I should be aligned to the bottom of the Avatar.
222
+ </Flex.Item>
223
+ <Flex.Item>
224
+ Me, too.
225
+ </Flex.Item>
226
+ <Flex.Item align="start">
227
+ I am aligning myself to the top.
228
+ </Flex.Item>
229
+ </Flex>
230
+ ```
231
+
232
+ ### Justifying Flex.Items
233
+
234
+ Use the `justifyItems` property to change the justification of Flex.Items.
235
+
236
+ ```js
237
+ ---
238
+ type: example
239
+ ---
240
+ <div>
241
+ <Flex justifyItems="center" margin="0 0 large" withVisualDebug>
242
+ <Flex.Item>
243
+ <Avatar name="Sarah Robinson" size="large" src={avatarSquare} />
244
+ </Flex.Item>
245
+ <Flex.Item>
246
+ We are all centered!
247
+ </Flex.Item>
248
+ <Flex.Item>
249
+ Yeah!
250
+ </Flex.Item>
251
+ </Flex>
252
+
253
+ <Flex justifyItems="space-between" withVisualDebug margin="0 0 large">
254
+ <Flex.Item>
255
+ <Avatar name="Sarah Robinson" size="large" src={avatarSquare} />
256
+ </Flex.Item>
257
+ <Flex.Item>
258
+ Ah, a little more space.
259
+ </Flex.Item>
260
+ <Flex.Item>
261
+ Totally.
262
+ </Flex.Item>
263
+ </Flex>
264
+
265
+ <Flex justifyItems="end" withVisualDebug>
266
+ <Flex.Item>
267
+ <Avatar name="Sarah Robinson" size="large" src={avatarSquare} />
268
+ </Flex.Item>
269
+ <Flex.Item>
270
+ Smooshed again.
271
+ </Flex.Item>
272
+ <Flex.Item>
273
+ Ugh.
274
+ </Flex.Item>
275
+ </Flex>
276
+ </div>
277
+ ```
278
+
279
+ ### Handling overflow
280
+
281
+ When `direction` is set to `column`, Flex.Items' `overflowY` property is automagically set
282
+ to `auto` to account for content overflow with a vertical scrollbar. Add padding, so focus rings are not cut off.
283
+
284
+ > To override this default, simply set `overflowY` on the Flex.Item to either `visible` or `hidden`.
285
+
286
+ ```js
287
+ ---
288
+ type: example
289
+ ---
290
+ <Flex
291
+ withVisualDebug
292
+ direction="column"
293
+ >
294
+ <Flex.Item padding="small">
295
+ <Heading>Pandas are cute, right?</Heading>
296
+ </Flex.Item>
297
+ <Flex.Item>
298
+ <TextInput name="name" renderLabel="If you dont add padding, the focus ring will be cut off!" />
299
+ </Flex.Item>
300
+ <Flex.Item size="150px" padding="small">
301
+ <Img src={avatarSquare} />
302
+ </Flex.Item>
303
+ </Flex>
304
+ ```
305
+
306
+ ### A few common layouts
307
+
308
+ #### Heading and button combination
309
+
310
+ ```js
311
+ ---
312
+ type: example
313
+ ---
314
+ <Flex>
315
+ <Flex.Item shouldGrow shouldShrink padding="none medium none none">
316
+ <Heading>Lorem ipsum dolor sit amet consectetur dolor sit</Heading>
317
+ </Flex.Item>
318
+ <Flex.Item>
319
+ <Button margin="none x-small none none">
320
+ Cancel
321
+ </Button>
322
+ <Button color="success" renderIcon={IconUserSolid}>
323
+ Add user
324
+ </Button>
325
+ </Flex.Item>
326
+ </Flex>
327
+ ```
328
+
329
+ #### Centered content (note the nested Flex components and use of the `wrap` property)
330
+
331
+ ```js
332
+ ---
333
+ type: example
334
+ ---
335
+ <Flex height="32rem" justifyItems="center" padding="large" withVisualDebug>
336
+ <Flex.Item shouldShrink shouldGrow textAlign="center">
337
+
338
+ <Heading level="h1" margin="0 0 medium">An amazing thing!</Heading>
339
+
340
+ <Flex withVisualDebug wrap="wrap" justifyItems="space-around" margin="0 0 medium">
341
+ <Flex.Item padding="small">
342
+ <SVGIcon src={iconExample} size="medium" title="Icon Example" />
343
+ <Text weight="bold" size="large" as="div">We love you!</Text>
344
+ </Flex.Item>
345
+ <Flex.Item padding="small">
346
+ <SVGIcon src={iconExample} size="medium" title="Icon Example" />
347
+ <Text weight="bold" size="large" as="div">We love you!</Text>
348
+ </Flex.Item>
349
+ <Flex.Item padding="small">
350
+ <SVGIcon src={iconExample} size="medium" title="Icon Example" />
351
+ <Text weight="bold" size="large" as="div">We love you!</Text>
352
+ </Flex.Item>
353
+ </Flex>
354
+
355
+ <div>
356
+ <Button color="primary" size="large">Sign up now!</Button>
357
+ </div>
358
+
359
+ </Flex.Item>
360
+ </Flex>
361
+ ```
362
+
363
+ #### Quick and dirty mobile app layout
364
+
365
+ ```js
366
+ ---
367
+ type: example
368
+ ---
369
+
370
+ <Flex height="400px" width="300px" as="div" direction="column" withVisualDebug>
371
+
372
+ <Flex.Item padding="small" as="header" textAlign="center">
373
+ <Heading level="h3">App</Heading>
374
+ </Flex.Item>
375
+
376
+ <Flex.Item shouldGrow shouldShrink padding="small" as="main">
377
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
378
+ </Flex.Item>
379
+
380
+ <Flex.Item padding="small" as="footer">
381
+
382
+ <Flex withVisualDebug justifyItems="space-between">
383
+ <Flex.Item>
384
+ <IconButton
385
+ renderIcon={IconEmailLine}
386
+ withBackground={false}
387
+ withBorder={false}
388
+ screenReaderLabel="Some app function"
389
+ />
390
+ </Flex.Item>
391
+ <Flex.Item>
392
+ <IconButton
393
+ renderIcon={IconPrinterLine}
394
+ withBackground={false}
395
+ withBorder={false}
396
+ screenReaderLabel="Some app function"
397
+ />
398
+ </Flex.Item>
399
+ <Flex.Item>
400
+ <IconButton
401
+ renderIcon={IconCalendarDayLine}
402
+ withBackground={false}
403
+ withBorder={false}
404
+ screenReaderLabel="Some app function"
405
+ />
406
+ </Flex.Item>
407
+ <Flex.Item>
408
+ <IconButton
409
+ renderIcon={IconSettingsLine}
410
+ withBackground={false}
411
+ withBorder={false}
412
+ screenReaderLabel="Some app function"
413
+ />
414
+ </Flex.Item>
415
+ </Flex>
416
+
417
+ </Flex.Item>
418
+ </Flex>
419
+ ```