How do I make a field support multiple types?

JSON schema supports a field having multiple types:

"type": [
                            "number",
                            "string",
                            "boolean",
                            "object",
                            "array",
                            "null"
                        ]

How can I support this in my jsonform? Perhaps a drop-down where the user selects the type, then is able to populate the field appropriately?
Object / Array (which could be an array of objects) gets kind of tricky…

Hi @kris,

Our off the shelf renderer sets don’t support multiple types. To support this you need to register a custom renderer which is able to handle it, for example via the UX you suggested.

I just thought…that JSON stringify/JSON parsing that one field may be the way I want to go.

I’m trying to extend MaterialTextControl. I’ve got a tester that finds the field… but when I try to modify props.data it’s telling me it’s read only.

It would be great if there were a repository of ‘extensions’ that people have written :).

All our own renderers work exactly the same way as custom renderers, so feel free to look through the code base on how we implemented them. Please also take a look at this tutorial for more information on how to implement a custom renderer.

For your case: The data prop is not meant to be modified directly. Every prop coming in from JSON Forms is read only. To perform an update you need to dispatch an action. For the most common action, which is to update data, we already hand over a simple helper handleChange which you can call with the changes you want to perform.