react-json-view icon indicating copy to clipboard operation
react-json-view copied to clipboard

Add ability to add a className prop

Open ashhadsheikh opened this issue 6 years ago • 5 comments

A lot of times, we've predefined classes that we want to use with this, need ability to pass that as prop. Thanks!

ashhadsheikh avatar Feb 18 '19 14:02 ashhadsheikh

I subscribe to this! I would love to be able to add classNames to the json viewer object.

When i do this:

<ReactJson
                            className="react-json-viewer rs-input"
                            src={json}
                          />{" "}

The component overrides it and shows only rect-json-viewer.

I could manually set each style element but my target here is to have the same style as rs-input elements, included hover and other actions css. Being able to do something like: extendClassname = "rs-input anotherClass" would save a considerable amount of time and help to unify the code.

I could try to do a PR regarding this issue if you're ok to add a new prop!

lveillard avatar Jun 16 '20 12:06 lveillard

Quick win for those wondering:

                        <div className="rs-input">
                            <ReactJson
                              src={answer}
                            />
                        </div>

Does the trick

lveillard avatar Jun 16 '20 12:06 lveillard

Will this be considered? It should be a minimal requirement to have. Thanks

obadakhalili avatar Jul 16 '21 15:07 obadakhalili

Since this repository is dead, I looked at the fork suggested by https://github.com/mac-s-g/react-json-view/commit/443465ebdaa236da8c5d0e7bda2b7e57ca5d5a7b

Looks like I cannot create issues in that fork. @Kikobeats, I'm tagging you since you seem to be one of the maintainers of https://github.com/microlinkhq/react-json-view. Two questions for you:

  1. is there a reason that repository does not accept tracking of issues?

  2. is it possible this issue here (and its fix PR https://github.com/mac-s-g/react-json-view/pull/377) be applied to https://github.com/microlinkhq/react-json-view ?

On another note, there is another fork that seems more receptive to feedback as it does allow reporting of issues (https://github.com/TexteaInc/json-viewer), although not sure how much divergence with the officially recommended fork. cc @pionxzh, if you care to elaborate.

Update: I was going through some issues and came across https://github.com/himself65/rich-data/issues/10. Not exactly sure what is going on there, but from first glance it seems best to avoid https://github.com/TexteaInc/json-viewer to avoid trouble.

renamartins avatar Apr 05 '24 13:04 renamartins

Thanks for mentioning our repo. I can provide some insights:

  1. TexteaInc/json-viewer aims to cover most features of mac-s-g/react-json-view and has added several useful enhancements. It's more like "inspired by" mac-s-g/react-json-view instead of a fork.
  2. We welcome issue reports and feature requests. However, considering my current focus and limited time for open source contributions, I can only promise that issues will be prioritized and fixed within 3-10 days.
  3. Regarding the concern you mentioned, it's a dispute between an employer and a former employee. You can still use the library without any concerns.

himself65/rich-data is also a great library for those who want to fully customize features and layout. You can make the decision based on your requirements.

Thank you for your understanding. 🙏

pionxzh avatar Apr 05 '24 17:04 pionxzh