Debian Codegraph @

node/@patternfly/react-core/src/layouts/Flex/examples/Flex.md

raw
1 ---
2 id: Flex
3 cssPrefix: pf-v6-l-flex
4 section: foundations-and-styles
5 subsection: layouts
6 propComponents: ['Flex', 'FlexItem']
7 ---
8
9 import './flex.css';
10
11 ## Flex basics
12
13 ### Basic
14
15 ```ts file="FlexBasic.tsx"
16
17 ```
18
19 ### Nesting
20
21 ```ts file="FlexNesting.tsx"
22
23 ```
24
25 ### Nested with items
26
27 ```ts file="FlexNestedItems.tsx"
28
29 ```
30
31 ### Spacing
32
33 The flex layout provides two ways of spacing its direct children.
34
35 - [Spacing system](#flex-spacing)
36 - The spacing system applies a margin between the flex layout's direct children to create space between items along the main axis only. The benefit of the spacing system is that it allows for variable spacing between direct children. Use the spacing system when individual flex items along the main axis require a different spacer than sibling items.
37 - [Gap spacing](#flex-gap-spacing)
38 - Gap spacing uses flex `gap` to space the flex layout's direct children, and can be applied to space rows (`row-gap`), columns (`column-gap`), or both (`gap`). The benefit of gap spacing is that item wrapping is improved and improved item spacing that works better with CSS flex's logical layout properties. E.g., spacing in RTL layouts that rely on logical properties is improved. Use the gap system when all direct children should use the same spacer for rows, columns, or both.
39 - **Note** using `gap` along the main axis will override any other spacing applied using the spacing system.
40
41 ### Flex spacing
42
43 ### Individually spaced
44
45 ```ts file="FlexIndividuallySpaced.tsx"
46
47 ```
48
49 ### Spacing xl
50
51 ```ts file="FlexSpacingXl.tsx"
52
53 ```
54
55 ### Spacing none
56
57 ```ts file="FlexSpacingNone.tsx"
58
59 ```
60
61 ### Flex gap spacing
62
63 ### Row gap
64
65 ```ts file="FlexRowGap.tsx"
66
67 ```
68
69 ### Column gap
70
71 ```ts file="FlexColumnGap.tsx"
72
73 ```
74
75 ### Gap
76
77 ```ts file="FlexGap.tsx"
78
79 ```
80
81 ### Flex layout modifiers
82
83 ### Default layout
84
85 ```ts file="FlexDefaultLayout.tsx"
86
87 ```
88
89 ### Inline
90
91 ```ts file="FlexInline.tsx"
92
93 ```
94
95 ### Using canGrow
96
97 ```ts file="FlexCanGrow.tsx"
98
99 ```
100
101 ### Adjusting width
102
103 ```ts file="FlexAdjustingWidth.tsx"
104
105 ```
106
107 ### Specifying column widths
108
109 ```ts file="FlexColumnWidths.tsx"
110
111 ```
112
113 ## Column layout modifiers
114
115 ### Column layout
116
117 ```ts file="FlexColumnLayout.tsx"
118
119 ```
120
121 ### Stacking elements
122
123 ```ts file="FlexStackingElements.tsx"
124
125 ```
126
127 ### Nesting elements in columns
128
129 ```ts file="FlexNestingInColumns.tsx"
130
131 ```
132
133 ## Responsive layout modifiers
134
135 ### Switching between direction column and row
136
137 ```ts file="FlexSwitchingColumnRow.tsx"
138
139 ```
140
141 ### Controlling width of text
142
143 ```ts file="FlexControlTextWidth.tsx"
144
145 ```
146
147 ## Flex alignment
148
149 ### Aligning right
150
151 ```ts file="FlexAligningRight.tsx"
152
153 ```
154
155 ### Align right on single item
156
157 ```ts file="FlexAlignRightSingleItem.tsx"
158
159 ```
160
161 ### Align right on multiple groups
162
163 ```ts file="FlexAlignRightMultipleGroups.tsx"
164
165 ```
166
167 ### Align adjacent content
168
169 ```ts file="FlexAlignAdjacentContent.tsx"
170
171 ```
172
173 ### Align self flex end
174
175 ```ts file="FlexAlignSelfFlexEnd.tsx"
176
177 ```
178
179 ### Align self center
180
181 ```ts file="FlexAlignSelfCenter.tsx"
182
183 ```
184
185 ### Align self baseline
186
187 ```ts file="FlexAlignSelfBaseline.tsx"
188
189 ```
190
191 ### Align self stretch
192
193 ```ts file="FlexAlignSelfStretch.tsx"
194
195 ```
196
197 ## Flex justification
198
199 ### Justify content flex end
200
201 ```ts file="FlexJustifyContentEnd.tsx"
202
203 ```
204
205 ### Justify content space between
206
207 ```ts file="FlexJustifyContentSpaceBetween.tsx"
208
209 ```
210
211 ### Justify content flex start
212
213 ```ts file="FlexJustifyContentFlexStart.tsx"
214
215 ```
216
217 ## Flex item order
218
219 ### First last ordering
220
221 ```ts file="FlexFirstLastOrder.tsx"
222
223 ```
224
225 ### Responsive first last ordering
226
227 ```ts file="FlexResponsiveFirstLastOrder.tsx"
228
229 ```
230
231 ### Ordering
232
233 ```ts file="FlexOrdering.tsx"
234
235 ```
236
237 ### Responsive ordering
238
239 ```ts file="FlexResponsiveOrdering.tsx"
240
241 ```
242
243 ### Alternative components
244
245 ```ts file="FlexAlternative.tsx"
246
247 ```