## plugin development – Gutenberg text field validation

Question

I have been searching for ages but can’t seem to find an exact method on how to perform text input validation when building custom blocks. I saw that for TextControl inputs you can just pass the required prop but that doesn’t seem to do anything ie: when I click on update or publish etc. it carries on like normal.

<TextControl
label="Title"
value={title}
onChange={(title) => setAttributes({ title })}
required
/>


The same issue would arise for RichText components as well.

0
6 months 2022-08-09T11:55:55-05:00 0 Answers 0 views 0