Skip to content

Add a mechanism to Heading blocks that allows you to control the available levels #63527

@ndiego

Description

@ndiego

The heading level dropdown in the Heading block is powered by the HeadingLevelDropdown component. This component accepts and options parameter that allows you to choose which levels are available in the dropdown. Unfortunately, there is no way to modify this options parameter from a Heading block.

Being able to modify the available levels is critical for heavily curated editing environments and block "governance".

Consider the following situations:

  • You only want to allow h2, h3, and h4 in Media & Text blocks.
  • You want to disable h1 on posts since the template already populates an h1 for the post title.
  • You want to disable the usage of h5 and h6 across the whole site.
  • etc.

Curating the available heading levels is currently not possible, but it should be easy to implement using an additional attribute for the Heading block. Developers can then modify this attribute as they need, either directly in theme patterns and templates or via block filters like blocks.registerBlockType or register_block_type_args.

Current functionality Goal
image image

Should the mechanism be added to Heading blocks, we should explore similar mechanisms for other blocks with level dropdowns, like Site Title, Post Title, etc.

Metadata

Metadata

Assignees

Labels

[Block] HeadingAffects the Headings Block[Feature] ExtensibilityThe ability to extend blocks or the editing experience[Status] DuplicateUsed to indicate that a current issue matches an existing one and can be closed[Status] In ProgressTracking issues with work in progress[Type] EnhancementA suggestion for improvement.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions