Below you will find pages that utilize the taxonomy term “gutenberg”
Posts
Wordpress custom blocks: Pass down attributes to child blocks
Suppose you are working on a set of interacting custom blocks in Wordpress. You have a child block that needs information from the parent block to display, in this situation, information about a specific record. In such a case you want to use Block context image/svg+xml .
Block context is a feature which enables ancestor blocks to provide values which can be consumed by descendent blocks within its own hierarchy.
Posts
Add JavaScript to a custom block in Wordpress
Using Wordpress custom blocks, I’m currently trying to create a popover component that contains a button and a hidden content. The hidden content should appear when the user clicks on or hovers over the button (on the frontend of the website, not in the block editor).
Problem However, when I add an onClick or onHover to the button, the event handler is not executed.
Additionally, trying to use the useState hook to store the display state of the popover crashes my block editor.