Skip to content
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 mechanism to use spacing presets #40854

Closed
fabiankaegy opened this issue May 5, 2022 · 1 comment
Closed

Add a mechanism to use spacing presets #40854

fabiankaegy opened this issue May 5, 2022 · 1 comment
Labels
[Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. Needs Design Needs design efforts.

Comments

@fabiankaegy
Copy link
Member

fabiankaegy commented May 5, 2022

What problem does this address?

Currently in Gutenberg if a block & theme have declared support for margin/padding controls the user is presented with a spacing control that allows them to input raw CSS Unit values. This comes with two issues however:

  1. Lack of consistency.
    Editors have the burden of using consistent spacing values throughout the site. They have to remember the exact value and unit they want to use for spacing across the site.

  2. Lack of responsive controls
    Another issue with exposing raw values is that they are fixed and don't adjust to various breakpoints. There currently is no way of adjusting the amount of spacing you want to use depending on the viewport size besides using viewport units in CSS which can lead to very undesired outcomes.

What is your proposed solution?

There should be an option for themes to define a spacing scale similar to how themes are able to provide font sizes or colors. Instead of exposing raw values, the user can be presented with a UI that allows them to choose from a predefined list of spacing options.

CSS Frameworks like Tailwind already use this approach of spacing scales. Here is the example of the spacing scale as defined in a tailwind.config.js.

module.exports = {
  theme: {
    spacing: {
      '1': '8px',
      '2': '12px',
      '3': '16px',
      '4': '24px',
      '5': '32px',
      '6': '48px',
    }
  }
}

The way this could work with the already existing UI of raw unit values is similar to how it works for Typography or Color options. The user first gets presented with the provided scale. They should then have an option to click a button to switch to set custom values. But the default should be choosing from a set of predefined spacing values.

@fabiankaegy fabiankaegy added Needs Design Needs design efforts. [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. Developer Experience Ideas about improving block and theme developer experience [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi and removed Developer Experience Ideas about improving block and theme developer experience labels May 5, 2022
@fabiankaegy
Copy link
Member Author

Duplicate of #39371

@fabiankaegy fabiankaegy marked this as a duplicate of #39371 May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. Needs Design Needs design efforts.
Projects
None yet
Development

No branches or pull requests

1 participant