CarlosNZ/json-edit-react

Custom Element for properties

Smejia25 opened this issue · 3 comments

Hi, More a doubt than a feature request, can you customize the property element ?, say for something like adding an icon next to the property name.

Thanks.

In theory, you can, but it would be a bit fiddly as you'd have to pass in a replacement node for the whole property/value display, which would be annoying if all you wanted to do was insert an icon like you suggest.

I might be able add an option in the custom node definitions to pass in the original node and property element so you can choose to render it as part of a custom node. (You can already do this with "Collection" nodes, as you can render the children prop, but not so with primitive value nodes)

I'll have a think about the cleanest way to implement this without adding performance burden. Thanks for the suggestion. :)

Thanks for the swift answer, amazing library.

@Smejia25 just wanted to let you know that you should be able to do what you want a bit easier now, with v1.24.0

In particular, take note of the passOriginalNode prop in customNodeDefinitions and the expanded documentation for Custom Nodes in general: https://github.com/CarlosNZ/json-edit-react?tab=readme-ov-file#custom-nodes

Let me know if you need any assistance getting it working.