WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.3k stars 4.11k forks source link

Radii #63703

Open jameskoster opened 1 month ago

jameskoster commented 1 month ago
radius

Recent work has expanded the values used for border radius in the UI. Specifically; the new menu component, document title, and command palette all make use of a larger 4px radius. The preview / content frame, and modal radius is larger still: 8px.

A defined scale for radius can add polish to the UI. For example compare how menu items nest neatly inside their container in the new menu component, compared with the current one:

DropdownMenu V2 DropdownMenu
Screenshot 2024-07-11 at 16 32 17 Screenshot 2024-07-11 at 16 32 26

Ad hoc proliferation of values for radius is going to create a maintenance headache down the road, so it would be good to think systematically about a refreshed radius scale, and semantic application thereof.

Radius scale

radius2

Members of the design team have been looking into this and formulated the following scale/guidelines:

Note: The values assigned to each item in the scale can be decided separately, but we can discuss those here too.

Implementation

Once we find consensus around the scale and values, a possible implementation plan might look like:

ciampo commented 1 month ago

Some feedback points on the naming:

How do other design systems call their radius scale?

Also, should this be a 1:1 of what will be included for radii in the theme package?

hanneslsm commented 1 month ago

How do other design systems call their radius scale?

Usually xs, sm, md, lg in various spellings https://tailwindcss.com/docs/border-radius https://developer.apple.com/documentation/tvml/border-radius https://m3.material.io/styles/shape/overview

jameskoster commented 1 month ago

Good points. I was thinking there could be two parts;

Perhaps the latter is unnecessary?

ciampo commented 1 month ago

xs, sm, md, lg, as suggested

That is definitely clearer to understand. The alternative is to go even more "literal" and use a number-based scale (example)

Semantic tokens that help clarify which radius to use in a given situation. Names TBD :) Perhaps the latter is unnecessary?

The risk of using semantic names is that, depending on what names are chosen, they can get "out of sync" if the design direction updates. Are there other design systems adopting semantic token names on top of a "neutral" scale?

Maybe a good way to move forward is to start without semantic tokens, get a feel for it, and re-discuss if we feel like semantic tokens would be a nice addition?

jameskoster commented 1 month ago

Semantic tokens is something we've been exploring in Figma for colors. But it might not need to be codified, especially for less-used scales like Radius.

Starting without tokens seems very reasonable.

mattrwalker commented 1 month ago

I agree with the Polaris example of naming being clearer but also potentially presenting risk if specific values are ever needed updating. The t-shirt size approach is a great iteration of the naming that feels clearer while also allowing us some flexibility to adjust values in the future too, I'd be in favor of the T-shirt size naming whenever we're ready to create tokens.

We could also ensure that descriptions and usage guidance for each radii are defined and communicated clearly whenever it's referenced to ensure folks know how and when to use the right radius.

Great breakdown per usual @jameskoster