Skip to content

Global Styles: Elements support tracking issue #40966

Closed
@scruffian

Description

What are elements?

Elements are a representation of HTML primitives that be used inside blocks. Some examples include link, heading and button.

Why use elements?

Many different blocks can use the same elements. By using elements inside blocks we make it possible for all elements to share the same styles regardless of what block they are in. This is powerful for elements like buttons and form fields which are used in many different blocks. If block developers use the elements in their blocks then themers and users will be able to ensure that all blocks have matching styles without using CSS.

What's the difference between an element and a block?

Elements can be used exist in many different blocks - they can be the things that blocks are built from, although not exclusively. For example the Button block uses a button element, as does the Search block and File block.

Which styles win, the block styles or the element styles?

Elements are lower down in priority order, so block styles will take precedence. This means you can have consistent styles across all buttons on your site with the exception of one particular block.

Will blocks have to use elements?

No. Blocks are free to output whatever HTML they like, but we’d encourage block builders to use elements where they exist so that themes can control their appearance.

This is a tracking issue for adding support for more elements to Global Styles. Currently only headings and links are supported and there's not a full UI for them:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonNeeds Dev NoteRequires a developer note for a major WordPress release cycle[Feature] ThemesQuestions or issues with incorporating or styling blocks in a theme.[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions