Category-Based Block Filtering in Theme Development

Currently, section/block schemas only allow filtering blocks by type:

{ "blocks": [{ "type": "group" }] }

As theme systems grow, this can become limiting when organizing larger block libraries.

Suggested Enhancement

Allow filtering by category, like:

{
  "blocks": [
    { "type": "@theme" },
    { "category": "navigation" },
    { "category": "product" }
  ]
}

Real-World Use Case

Let’s say we have private blocks and want to include all navigation-related blocks in our header section. Currently, we have to list each block individually:

"blocks": [
  { "type": "@theme" },
  { "type": "_header-logo" },
  { "type": "_header-menu" },
  { "type": "_header-icon" },
  { "type": "_header-search-bar" }
  // ... and so on for every navigation block
]

With category-based filtering, we could simply do:

"blocks": [
  { "type": "@theme" },
  { "category": "header_navigation" }
]

Benefits

  • Automatic inclusion: New blocks are automatically available when you give them the "category": "header_navigation" tag
  • Cleaner schemas: No need to manually update section schemas when adding new blocks
  • Better organization: Logical grouping of related blocks
  • Scalability: Easy to manage growing block libraries

Would love to hear if others would find this useful.

1 Like

I would say there are more pressing matters when it comes to theme blocks but definitely a nice quality of life suggestion !