How to Create and Use Custom supports in Gutenberg Blocks #71012
Replies: 3 comments
-
|
I think similar types of questions are more suitable for GitHub discussions. |
Beta Was this translation helpful? Give feedback.
-
|
@theaminuli I think it is possible for you to implement custom supports, but unfortunately I'm not aware of any guides. My understanding is that most of the block supports features are implemented in this folder: So looking at the source code might be the best way of learning. In the past, a lot of these have used regular editor block filters (https://developer.wordpress.org/block-editor/reference-guides/filters/block-filters/#editor) like:
And probably others too, so there's no reason you can't do the same. I think there might be a slightly newer API now, I don't know it as well or whether it's available for extenders. Maybe others can help answer. |
Beta Was this translation helpful? Give feedback.
-
|
@theaminuli Core blocks and custom blocks are essentially the same. This also applies to block support, and it's possible to add your own support. However, to make your custom block support work properly in the same way as core blocks, you need to take advantage of a wide range of APIs and hooks, which requires deep knowledge of the block architecture, and, as far as I know, no tutorials exist. You'll need to understand the sources and documentation presented in this comment. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello Gutenberg Team 👋,
I'm exploring the extensibility of the supports API in Gutenberg and I have a question regarding the creation and usage of custom block supports.
From the documentation (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/), I understand how core-supported features like align, color, or typography work.
However, I want to go a step further and define my own custom support, for example:
supports: { myCustomSupport: true, }I’d like to:
Could you please guide me on:
A code example or reference to any internal implementation would be incredibly helpful.
Thanks for your amazing work on Gutenberg and for making WordPress development so powerful! 🙌
Best regards,
@theaminuli
Beta Was this translation helpful? Give feedback.
All reactions