Skip to content

Allow creating/registering block variations from the UI #698

Open
@madhusudhand

Description

@madhusudhand

Allow registering new block variations and style them without leaving the editor.

Idea:

A theme can register new buttons variations such as pill, rounded, circular and style them to be used in the editor.

Pill Rounded Circular
image image image

Currently it is not possible to create such variations from the editor.
A block variations can be registered with javascript

const { registerBlockStyle } = wp.blocks;
registerBlockStyle('core/button', {
  name: 'pill',
  label: _x('Pill', 'block style', 'theme-name'),
});

this creates a new button variations and adds a css class wp-block-button is-style-pill which can be styled from the editor global styles.

Proposal:

Create block theme can have a UI to create a new block variation, (which adds the required javascript code and enqueues is safely).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions