Skip to content

Allow creation of a limited list of spacing options for spacing.units #34210

@eric-michel

Description

@eric-michel

What problem does this address?

Getting custom padding, margin, and border controls in Gutenberg is great! But allowing any amount of spacing may be too flexible for some users.

What is your proposed solution?

Similar to the way font size options can be limited to a dropdown of options, having spacing.units in theme.json support an array of values would allow us to create a curated list of spacing options for our less tech-savvy users.

For instance, it would be great if theme.json supported something like this:

"spacing": {
	"units": [
		{
			"slug": "xs",
			"size": "0.25rem",
			"name": "XS"
		},
		{
			"slug": "sm",
			"size": "0.5rem",
			"name": "SM"
		},
		{
			"slug": "md",
			"size": "1rem",
			"name": "MD"
		},
		{
			"slug": "lg",
			"size": "2rem",
			"name": "LG"
		},
		{
			"slug": "xl",
			"size": "4rem",
			"name": "XL"
		},
	]
},

Then, when adding custom padding to a block, these spaces would be dropdowns instead of normal inputs:
image-(2)

This would make things easier for our content specialists and clients who manage their own content, and want to have some more control over design without the confusion of various units and what they mean.

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Design ToolsTools that impact the appearance of blocks both to expand the number of tools and improve the experi[Type] EnhancementA suggestion for improvement.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions