Skip to content

Pattern styles #59404

@mtias

Description

@mtias

Problem scope

When building a website it's common to have sections within the site that vary in style (colors, typography, etc). One section may be light and another dark. These sections may also use the same layout. To do this in the block editor you currently have to manually style inner elements and blocks for each and every section. This is not an efficient process.

If theme authors want to provide different variations of a pattern, they currently need to ship multiple patterns.

How might we simplify the styling process for end users and enable theme authors to ship multiple ways of styling content based on a single palette?

Strategy

This aligns with the goal of empowering designers and developers, as well as addressing needs of the enterprise sector. It balances the qualities of the end user experience and the needs of larger teams or maintainers creating constraints around styling.

Solution

Leverage the theme.json definition allowing it to be scoped as a block style. This allows the same mechanism used to style globally to apply on scoped elements. This can be blocks, patterns, or entire templates. Furthermore, allow subsets of style definitions to affect specific parts of the design by detecting when a variation only affects colors or only affects typography.

pattern-styles.mp4

Tasks

Metadata

Metadata

Labels

Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Feature] PatternsA collection of blocks that can be synced (previously reusable blocks) or unsynced[Type] OverviewComprehensive, high level view of an area of focus often with multiple tracking issues

Type

No type

Projects

Status

Next

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions