1

I'm building a simple Gutenberg Block that lets the user create just headlines and lists. I've got a solution, but the user can select any heading level she or he wants to.

How I can I restrict the core/heading block to e.g. heading level H4?

The crucial part in my edit.js is this:

return (
    <div {...blockProps}>
        <InnerBlocks
            onChange = { onChangeContent }
            allowedBlocks={ ['core/list', 'core/heading'] }
        />
    </div>
)

1 Answer 1

0

Since the allowed blocks are entered as strings there is no way to add parameters to them. You would have to make your own component for each heading type.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.