gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Add UI to Global styles to allow managing spacing presets

Open matiasbenedetto opened this issue 2 years ago • 18 comments

What?

Add UI to Global styles to allow modification and creation of spacing scale preset values.

Why?

This will allow users to edit the spacing presets using the editor.

matiasbenedetto avatar May 25 '24 17:05 matiasbenedetto

My apologies if this has been covered somewhere else but I wanted to mention it on this issue due to cross concerns.

I make use of clamp in spacings. It's been working great to dynamically adjust content density. If this could be accounted for and handled exactly how font sizes work, it would be amazing. This would require an adjustment to theme.json schema to accept a min and max value. The UI would then be very similar to the new fonts UI.

christopherabalos avatar Aug 07 '24 18:08 christopherabalos

This issue has been punted to 6.8 and has not seen any activity since. Let's move this issue to the 6.9 Editor Task Board and see what can be done in 6.9.

t-hamano avatar Aug 22 '25 02:08 t-hamano

This issues hasn't seen any activity since 6.7. Is it still relevant?

ryanwelcher avatar Sep 15 '25 18:09 ryanwelcher

I believe this is still relevant. It feels like one of the last remaining pieces of UI needed to fully unlock website presentation management. I’m not sure if this will make it into 6.9, but I do think it’s worth keeping on the radar. We could likely build on what was done for font presets. The main challenge will be figuring out how to handle themes that define spacing with clamp(), which means designing a suitable UI control for that.

juanfra avatar Sep 17 '25 12:09 juanfra

I believe this is still relevant. It feels like one of the last remaining pieces of UI needed to fully unlock website presentation management. I’m not sure if this will make it into 6.9, but I do think it’s worth keeping on the radar. We could likely build on what was done for font presets. The main challenge will be figuring out how to handle themes that define spacing with clamp(), which means designing a suitable UI control for that.

Thanks for the reply! I think I should have been more clear, I was not advocating for closure rather to see if this would be part of 6.9 which unless someone picks it up, it will most likely not be.

ryanwelcher avatar Sep 17 '25 16:09 ryanwelcher

if this would be part of 6.9 which unless someone picks it up, it will most likely not be.

I agree, I think this task is a "nice to have" and not required for 6.9.

t-hamano avatar Sep 18 '25 09:09 t-hamano

Thanks for clarifying! That makes sense and I agree.

juanfra avatar Sep 18 '25 13:09 juanfra

I am happy to look at this now it has needs design on it. I will try and do so within next few days to at least get a first pass.

karmatosed avatar Sep 22 '25 10:09 karmatosed

Let's me collab with @karmatosed to audit this issue.

khoipro avatar Sep 22 '25 10:09 khoipro

Thank you @karmatosed @khoipro I will move this issue to In Progress status.

P.S. I'm not saying this issue is mandatory for 6.9 🙂

t-hamano avatar Sep 22 '25 10:09 t-hamano

I’ve been playing around with this over the past few days and put together a quick prototype. As I mentioned in my previous message, I believe the main challenge seems to be finding a good UI for handling clamp values, since we’ll need to provide controls for all three parts (min, preferred, and max). The way I feel it would work best is to do something similar to how font size presets handle fluid typography., so curious to hear your thoughts.

https://github.com/user-attachments/assets/1aed2b66-5103-4b6b-ae2d-7f028f33401c

juanfra avatar Sep 22 '25 13:09 juanfra

Just coming around to this and I don't see anything initially from you @khoipro so I am going to jump in to see what I can do. I know your plans were to work on something, but I want to keep this moving.

@juanfra that's a pretty sound prototype and I think you raise some key points and also how we can learn from existing interface. We I think have all the components we need here, it's just how we use them. It does however feel like this has gone from a simple interface to a maybe wider implementation and I would therefore like to just check if there are other plans in the system for this or not. Looping in @jasmussen just to get a balance and eyes on this from a design system view.

karmatosed avatar Sep 30 '25 13:09 karmatosed

At a glance this seems on a decent track. (Thanks for the ping, and kudos for the nice work.)

I'd love to get some eyes from some theme designers I know, such as @henriqueiamarino or @iamtakashi, for their instincts, in case they get these pings.

Designwise, I'd ensure the blue spot color used is the same as the accent color for buttons, or is gray. And if you can give the container a fixed height so it avoids layout shifts, that might help.

jasmussen avatar Oct 01 '25 08:10 jasmussen

Many default themes use presets such as min and clamp functions as values. While we may not need to support these in the initial implementation, most users will likely want a more flexible preset UI.

t-hamano avatar Oct 01 '25 08:10 t-hamano

I think we discussed this a fair bit with fluid typography, and it still feels valid to offer also there a simple input field where you can type your own value. That would mean expanding/refining this UI a bit further:

Image

But ideally we can have a similar UI between these two.

jasmussen avatar Oct 01 '25 09:10 jasmussen

Thanks for the ping. My apologies if my feedback isn't helpful, as I'm not aware of all the context.

I personally use clamp all the time (apart from the tiny ones below 10px) to make the theme work better for different viewport sizes.

I can see the value of providing the UI for it, but if it only supports absolute values, it's kind of making the site "less responsive" without the owners realising. It may also cause a similar issue that the Spacer block has.

iamtakashi avatar Oct 01 '25 15:10 iamtakashi

Thanks everyone for the feedback. Great that we’re aligned on reusing the pieces from the fluid typography controls. I’ll keep evolving the prototype, and once it’s close to final I’ll open a PR so we can review it properly.

juanfra avatar Oct 02 '25 07:10 juanfra

With WordPress 6.9 Beta 1 just around the corner and we can no longer ship enhancements, so I'd like to punt this to 7.0.

t-hamano avatar Oct 20 '25 14:10 t-hamano