-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Customize the styling of the key value pair #223
Comments
I have the same requirement, do you have any workaround yet? thanks |
Same request goes from me. This component is okay but it lacks customisation. Would be great if we could have the option how to render each item. For example having a method like |
same requirement, is there any solution? |
curious about this as well, would appreciate any workarounds people came up with |
Yea, my usecase is pretty much same. I want to customise some items style based on some conditions. This component is fine, lacks customization. |
Need same requirement, I have to highlight specific child JSON nodes. Any other solution? |
I wrote this workaround for a key I wanted to highlight. Very ugly, but does the job for me :/ // Hightlight value
useEffect(() => {
const timeout = setTimeout(() => { // Timeout for the node to exist in DOM
const target = Array.from(document.querySelectorAll('.react-json-view span.object-key'))
.find((el) => el.textContent === 'keyToFind')
?.parentElement
?.parentElement
?.querySelector('div.variable-value .string-value');
if (target && target.textContent) {
(target as HTMLSpanElement).style.backgroundColor = '#16a34a';
(target as HTMLSpanElement).style.color = '#ffffff';
(target as HTMLSpanElement).style.padding = '4px';
(target as HTMLSpanElement).style.fontWeight = '700';
}
}, 100);
return () => clearTimeout(timeout);
}, [data]); |
Great work on the package !!
I was having a use case, whereby it would be good if we could search the keys in the object and open the corresponding node.
I have managed to do that , using the
shouldCollapse
attribute but it would have been good if I could somehow highlight the node that I had searched for. Is there any way, we can style a particular node. The use case is not to change the theme but to somehow customize the style of the individual node.The text was updated successfully, but these errors were encountered: