Skip to content

Add gap utility classes - #2281

Merged
zatteo merged 2 commits into
masterfrom
feat/gap-utilities
Jul 29, 2026
Merged

zatteo merged 2 commits into
masterfrom
feat/gap-utilities

Conversation

@PolariTOON

@PolariTOON PolariTOON commented Nov 4, 2022

Copy link
Copy Markdown
Contributor

We often need to put some regular spacing between elements. I learned there are the u-stack-* classes that basically allow that, but :

  • in only one direction
  • by overriding margins

At the end, it seems we don't really use these classes but rather margin utility classes on each element.

As we often are in flex contexts, i propose adding new gap utility classes that do not have these limiations and allow to add gutters between child nodes (not elements) of a flex element by declaring them only at a single location.
Gaps can also be used in grid contexts and multi-column layouts, and eventually will likely be compatible with subgrids, masonry layouts, table layouts, multi-row layouts...

Demo link: https://polaritoon.github.io/cozy-ui/styleguide/section-utilities.html#kssref-utilities-gaps

@bundlemon

bundlemon Bot commented Nov 4, 2022

Copy link
Copy Markdown

BundleMon

Files updated (2)
Status Path Size Limits
dist/cozy-ui.min.css
17.73KB (+674B +3.86%) -
dist/cozy-ui.utils.min.css
11.21KB (+672B +6.22%) -
Unchanged files (1)
Status Path Size Limits
transpiled/react/stylesheet.css
11.23KB -

Total files change +1.31KB +3.38%

Unchanged groups (1)
Status Path Size Limits
transpiled/react/**
393.31KB -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@JF-Cozy

JF-Cozy commented Nov 8, 2022

Copy link
Copy Markdown
Collaborator

Partons sur les composants Stack ou Grid pour gérer ces cas

@JF-Cozy

JF-Cozy commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

a few moment later... ⏳ around 4 years 🤣

Comment thread stylus/utilities/spaces.styl Outdated
Comment thread stylus/cozy-ui/build.styl Outdated
Comment thread stylus/cozy-ui/build.styl
.u-g-auto - Auto gaps in both directions
.u-g-0 - No gaps in both directions
.u-g-half - Gaps in both directions with half a line (8px)
.u-g-1 - Gaps in both directions with 1 line (16px)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't know if u-g- is clearer than u-gap- . I assume with u-g we copy margin/padding approach 🤔

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is the purpose. Actually everything is copy/pasted from margin/padding except we have only vertical/horizontal and auto is replaced by normal.

Comment thread stylus/cozy-ui/build.styl

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commit should be squashed, you know it ;)

@zatteo
zatteo force-pushed the feat/gap-utilities branch from 504eef4 to ce5fae2 Compare July 29, 2026 08:43
@zatteo
zatteo merged commit 0fb3588 into master Jul 29, 2026
12 checks passed
@zatteo
zatteo deleted the feat/gap-utilities branch July 29, 2026 11:53
@cozy-bot

Copy link
Copy Markdown

🎉 This PR is included in version 140.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

doubleface added a commit to linagora/twake-drive that referenced this pull request Jul 30, 2026
Add gap utilities and fix iframe breakpoint targeting

 cozy-ui 140.5.2 → 141.0.0
 - cozy/cozy-ui#2281
 - cozy/cozy-ui#2950
doubleface added a commit to linagora/twake-drive that referenced this pull request Jul 30, 2026
Add gap utilities and fix iframe breakpoint targeting

 cozy-ui 140.5.2 → 141.0.0
 - cozy/cozy-ui#2281
 - cozy/cozy-ui#2950
doubleface added a commit to linagora/twake-drive that referenced this pull request Jul 30, 2026
Add gap utilities and fix iframe breakpoint targeting

 cozy-ui 140.5.2 → 141.0.0
 - cozy/cozy-ui#2281
 - cozy/cozy-ui#2950
doubleface added a commit to linagora/twake-drive that referenced this pull request Jul 30, 2026
Add gap utilities and fix iframe breakpoint targeting

 cozy-ui 140.5.2 → 141.0.0
 - cozy/cozy-ui#2281
 - cozy/cozy-ui#2950
doubleface added a commit to linagora/twake-drive that referenced this pull request Jul 30, 2026
Add gap utilities and fix iframe breakpoint targeting

 cozy-ui 140.5.2 → 141.0.0
 - cozy/cozy-ui#2281
 - cozy/cozy-ui#2950
doubleface added a commit to linagora/twake-drive that referenced this pull request Jul 30, 2026
Add gap utilities and fix iframe breakpoint targeting

 cozy-ui 140.5.2 → 141.0.0
 - cozy/cozy-ui#2281
 - cozy/cozy-ui#2950
doubleface added a commit to linagora/twake-drive that referenced this pull request Jul 31, 2026
Add gap utilities and fix iframe breakpoint targeting

 cozy-ui 140.5.2 → 141.0.0
 - cozy/cozy-ui#2281
 - cozy/cozy-ui#2950
doubleface added a commit to linagora/twake-drive that referenced this pull request Jul 31, 2026
Add gap utilities and fix iframe breakpoint targeting

 cozy-ui 140.5.2 → 141.0.0
 - cozy/cozy-ui#2281
 - cozy/cozy-ui#2950
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants