-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 a selection of preset spacing values to supplement/replace custom padding/margin options #35306
Comments
Hi! |
I have played around with it a bit using the Blockbase theme. As best I can tell there's no way to define a range of spacing sizes and get rid of the custom option completely like you can with font sizing? Something like this is what I have in mind: (Extremely rough mockup made by dragging things around in the inspector, a range slider might be better UX?) |
No, but you could disable the control and have block styles and it would work similarly. |
Yeah, that is least bad option available and what I’ve gone with. However, that leaves the user without any control over the amount of padding1 and there are obviously situations where you might want to allow that. The two options the editor provides right now are “no control” and “do whatever” and neither are a very good fit for producing high-quality websites. A sampling of workarounds I’ve come up with to deal with the lack of control when disabling custom padding amounts:
Problems I’ve encountered when allowing custom padding amounts:
The presets used for font size sit right in the middle of these two approaches and is an elegant solution to the problem. Content editors can choose a set of preset sizes, which reduce the need for entering custom values and can easily move between themes without causing design issues. Theme authors can then add to those presets and style them with whatever CSS they’d like, and can optionally disable the custom value field if it’s not a good fit for the goals of the theme. Footnotes
|
It's well documented around the web that inline styles should very much be the exception rather than the rule when aiming at consistent design and layout. This would be a good step in that direction 👍 |
+1 on this. Spacing and typography are fundamentals and should be a higher priority than new features. Spacing is by far my biggest issue working on new Gutenberg themes and a more versatile and stylesheet-controlled way as proposed by OP would be ideal. The spacer block is not enough and I am currently working with custom classes for the additional classes option which is half way there, but a control would be great. |
Moving discussion of this to #39371. |
What problem does this address?
Spacing quickly becomes inconsistent across a larger site with extensive use of the custom padding/margin options in Gutenberg. It's very difficult to keep a design feeling cohesive if every editor has to manually apply the same padding value when adding a columns block. Additionally, because these custom values are output as inline styles it then becomes extremely difficult to revise this if you decide you'd really like some more padding in your columns blocks.
What is your proposed solution?
The font size system provides a decent blueprint. On the back end, users should be able to pick from a list of preset options in addition to the custom margin/padding field, and theme authors should be able to register their own presets and disable the custom field entirely. On the front end, these presets should be output as classes like
has-spacing-small
, avoiding the problems associated with inline styles.The text was updated successfully, but these errors were encountered: