How to create a Gutenberg block with your own list, inside which there will be o
-
How to create a Gutenberg block with your own list, inside which there will be other tags?
I found this solution to create a block with a list:
return el( 'div', { className: props.className }, el( RichText, { tagName: 'ul', multiline: 'li', placeholder: i18n.__( 'Write yours ingredients…', 'gutenberg-examples' ), value: attributes.ingredients, onChange: function( value ) { props.setAttributes( { ingredients: value } ); }, className: 'ingredients', } ) ); }, save: function( props ) { var attributes = props.attributes; return el( 'div', { className: props.className }, el( RichText.Content, { tagName: 'ul', className: 'ingredients', value: attributes.ingredients, } ) );
But it outputs the result:
<ul class="ingredients"> <li>Ingredient 1</li> <li>Ingredient 2</li> <li>Ingredient 3</li> </ul>
And I need to do:
<ul class="list"><li class="list-item1"> <input type="checkbox" class="hidden-box" id="ingr1"> <label for="ingr1" class="check--label"> <span class="check--label-box"></span> <span class="check--label-text">Ingredient 1.</span> </label> </li><li class="list-item2"> <input type="checkbox" class="hidden-box" id="ingr2"> <label for="ingr2" class="check--label"> <span class="check--label-box"></span> <span class="check--label-text">Ingredient 2.</span> </label> </li><li class="list-item3"> <input type="checkbox" class="hidden-box" id="ingr3"> <label for="ingr3" class="check--label"> <span class="check--label-box"></span> <span class="check--label-text">Ingredient 3.</span> </label> </li></ul>
Does anyone know how to put <input>, <label> and <span> inside < li > ?
///Sorry for the bad english. I hope my question is clear.
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘How to create a Gutenberg block with your own list, inside which there will be o’ is closed to new replies.