Skip to content

Style variations for block types #44417

@jameskoster

Description

@jameskoster

Block style variations are preset block designs. A button defaults to being filled, but has an outline variation. We could expand this system so that it was possible to edit style variations, as well as creating new custom ones. For example, I might want to create a paragraph style with a slightly larger font size and a drop-cap for occasional use in my posts / pages. By creating a Style, I am empowered to update all blocks utilising that style at once, whereas currently I'd need to update all blocks one-by-one.

You might find access to managing style variations in an ellipsis menu:

Style variations

Style variations would show up in a list below other block-specific properties, in Global Styles → Blocks → Block name:

Editing style variations

Style variations can be conceptually thought of as fitting somewhere between "Theme" and "User" in the style hierarchy, so any customizations you apply exist on top of existing values, rather than replacing them:

Overriding style variations

This would let you edit a style variation globally, and all blocks using that variation get updated as a result.

Note that this particular aspect needs a little further thought, please see the comments below as well.

Related: #44361


Issue updated Nov 11.

Initial proposal

Theme style variations allow users to change the look and feel of their entire site in a few clicks:

Screenshot 2022-09-23 at 12 03 55

It would be interesting to explore how we might apply this concept to individual blocks in global styles. For example, I might want to create a paragraph style with a slightly larger font size and a drop-cap for occasional use in my posts / pages. By creating a Style, I am empowered to update all blocks utilising that style at once, whereas currently I'd need to update all blocks one-by-one.

We can hopefully connect this to the current block style system, giving folks control (create, update, delete) over styles like the one we find on the Button block:

Screenshot 2022-09-23 at 11 26 19

Related: #44361

Metadata

Metadata

Labels

Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Type] EnhancementA suggestion for improvement.

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions