Custom renderer and default validation

Let’s say I created my custom renderers but I want to use the custom validation that is provided out of the box. Is this possible?

1 Like

Hi @Icenwharth,

you mean you want to use a custom renderer but reuse the integrated validation of JSON Forms? This is of course possible! Note that there is absolutely no difference between off-the-shelf renderers provided by us and a custom renderer. Both use exactly the same API etc.

When you implement a custom renderer you will get an errors prop handed over. This is a string with the error message. If it is falsy then there is no error to show for the control. In case it has some content you can directly show this as the error message.

2 Likes

How to get errors as a props in custom renderer. Like how to import it. @Icenwharth @sdirix

@roshan-budhathoki

errors is just a prop which is handed over by the bindings. So when you wrapped your custom renderer correctly it will just be handed over. If you successfully use a custom renderer then it should already work. Please see this tutorial too.