The button block currently doesn’t allow for child elements. I understand the reasoning: only inline elements can be children of <button>
, so maybe it’s easier just to prevent any children.
However, a common use case is when you want to create a button with an icon/image on it. Right now, to do that you need to create a box, set the HTML tag to button
(which is buggy in its own way: Blocks don't respect the background color when you set the HTML tag to button), and then add your children.
Would be much simpler if you could add a child element and then Visual Editor highlights an error if the element isn’t inline, prompting the user to set display: inline-block
or something like that.
Idea (vote if you agree): Allow buttons to accept inline children | Builder.io Ideas