Skip to content

Commit aebd30a

Browse files
authored
Merge pull request #423 from ember-learn/button-group
Flex helper classes
2 parents 3c6cf18 + eaf9a7d commit aebd30a

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

addon/styles/helpers/flex.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,15 @@
44
display: flex;
55
justify-content: space-between;
66
}
7+
8+
.flex-responsive{
9+
display: flex;
10+
flex-wrap: wrap;
11+
gap: var(--spacing-1);
12+
}
13+
14+
.flex-centered {
15+
display: flex;
16+
justify-content: center;
17+
align-items: center;
18+
}

docs/css/helpers.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,38 @@ In order to apply the spacing scale on pages, a set of predefined helper classes
144144
</tbody>
145145
</table>
146146

147+
### Flex helpers
148+
149+
We provide a few `flex` helpers to make it easier to position elements on your page. All classes provide the `display: flex` property.
150+
151+
`.flex-horizontal-between` does `justify-content: space-between`.
152+
```html
153+
<div class="flex-horizontal-between">
154+
<button>Let's do this</button><button>Don't do this</button>
155+
</div>
156+
```
157+
158+
`.flex-center` does `justify-content: center` and `align-items: center`, making sure your content is centered.
159+
```html
160+
<div class="flex-centered">
161+
<button>Let's do this</button><button>Don't do this</button>
162+
</div>
163+
```
164+
165+
`.flex-responsive` adds `flex-wrap: wrap` to your element, making sure the content wraps with the parent. It adds a `gap` too. You can resize the window to see the effect of the class.
166+
```html
167+
<div class="flex-responsive">
168+
<button>Let's do this</button><button>Don't do this</button>
169+
</div>
170+
```
171+
172+
You can also combine these helper-classes, allowing the content to wrap and stay centered.
173+
```html
174+
<div class="flex-centered flex-responsive">
175+
<button>Let's do this</button><button>Don't do this</button>
176+
</div>
177+
```
178+
147179
### Responsive Videos
148180

149181
```html

0 commit comments

Comments
 (0)