Skip to content

Commit f2d3d82

Browse files
authored
feat(modules): add gap helpers (#208)
1 parent 3b5c1e1 commit f2d3d82

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

docs/helpers/flexbox.mdx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,27 @@ Use the following classes to control the order of flex items.
273273
</div>
274274
```
275275

276+
### Gap
277+
278+
Use the following classes to control the gap between flex items.
279+
280+
| Class | Property |
281+
| `has-gap-0` and `has-gap-none` | `gap: 0;` |
282+
| `has-gap-1` | `gap: 0.25rem;` |
283+
| `has-gap-2` | `gap: 0.5rem;` |
284+
| `has-gap-3` | `gap: 0.75rem;` |
285+
| `has-gap-4` | `gap: 1rem;` |
286+
| `has-gap-6` | `gap: 1.5rem;` |
287+
| `has-gap-8` | `gap: 2rem;` |
288+
289+
```html live=true color=white
290+
<div class="is-flex has-flex-no-wrap has-gap-6 has-text-center">
291+
<div class="has-p-4 is-rounded has-bg-primary has-w-96">1</div>
292+
<div class="has-p-4 is-rounded has-bg-primary has-w-96">2</div>
293+
<div class="has-p-4 is-rounded has-bg-primary has-w-96">3</div>
294+
</div>
295+
```
296+
276297
### Responsive flexbox helpers
277298

278299
Control the flexbox properties of an element at a specific breakpoint adding a `-{breakpoint}` suffix to the flexbox helper class. For example, you can change the direction of the flexbox items to column only on mobile devices adding the `has-direction-column-mobile` class to the container element:

packages/modules/helpers.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,22 @@ export const helpers = {
283283
last: "999",
284284
},
285285
},
286+
gap: {
287+
prefix: "has",
288+
shortcut: "gap",
289+
responsive: true,
290+
properties: ["gap"],
291+
values: {
292+
"none": "0",
293+
"0": "0",
294+
"1": "0.25rem",
295+
"2": "0.5rem",
296+
"3": "0.75rem",
297+
"4": "1rem",
298+
"6": "1.5rem",
299+
"8": "2rem",
300+
},
301+
},
286302
textAlign: {
287303
styles: {
288304
".has-text-justified": {

0 commit comments

Comments
 (0)