-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add gap utilities #2206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add gap utilities #2206
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a thing? For what reason should we not add this?
We chatted about this in our weekly sync and are mostly ok to add gap as a utility so we don't have to inline it in markup.
I remember talking about it in the past and at the time the conclusion was that we're gonna hold off since we plan to add the Stack component. But we still haven't prioritized the Stack component in PVC, so could still take a few months. And it might even help with migration to Stack.
/cc @vdepizzol that might have been in that discussion.
Is
g-the right prefix? Maybe we’d want to usegap-and preserveg-for something else?
I was debating about this too. 🤔 I guess g- would match the m- and p- for margin/padding, but I'm slightly in favor of gap-. Mostly because gap- is pretty short and would help explain what this new utility is for.
The docs copied the Margin page and removed irrelevant parts. What else should be added to this page?
Hmm.. maybe we could add some code examples to visualize the gap between items, like in https://primer.style/css/utilities/margin#uniform-margins?
Thanks for the context. I couldn’t remember where we’d landed on that but would love to land this if it’s going to be a while for Stack (and especially if it will help).
The more I think about it, the more I lean toward
Can do. |
I’ve added a section with some visualisations. I followed the conventions of the margin and padding visualisations but it’s a bit awkward; the It makes sense if you read the rest of the docs and look at the code examples. What do you think @simurai? |
Yeah, having the yellow taking up the whole block is a bit confusing. Maybe we could add an extra <div class="mt-3">
<div class="color-bg-attention d-inline-flex gap-3">
<div class="color-bg-subtle p-1">.gap-3</div>
<div class="color-bg-subtle p-1">.gap-3</div>
<div class="color-bg-subtle p-1">.gap-3</div>
</div>
</div> |
This came up again in Slack and there are concerns about adding the utilities just before we wanna move to the So an alternative could be to not add the But I can bring that up again in our next weekly sync. |
|
Closing this in favour of adding |


What are you trying to accomplish?
Add
gaputility classes matching other spacing utils.This would solve many issues of responsiveness I’ve run into while implementing layouts.
Something like this solves a lot of headaches with setting margins on elements, removing them from first/last elements, adding
margin-topbut only on small displays, etc.:What approach did you choose and why?
Looped through spacing values and breakpoints and created applicable classes with the
ggapprefix.What should reviewers focus on?
Should this be a thing? For what reason should we not add this?Isg-the right prefix? Maybe we’d want to usegap-and preserveg-for something else?Can these changes ship as is?
We’d probably want to illustrate the docs with some real-world examples. Since gap is a parent property that affects its children we’d want to consider the best way to show that.