diff --git a/README.md b/README.md index 20ad1189..c9fa6d3f 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ Name|Type|Default|Description `src`|`JSON Object`|None|This property contains your input JSON `name`|`string` or `false`|"root"|Contains the name of your root node. Use `null` or `false` for no name. `theme`|`string`|"rjv-default"|RJV supports base-16 themes. Check out the list of supported themes [in the demo](https://mac-s-g.github.io/react-json-view/demo/dist/). A custom "rjv-default" theme applies by default. +`className`|`string`|`undefined`|Additional `className` string to append to the `className` of react-json-view's container. `style`|`object`|`{}`|Style attributes for react-json-view container. Explicit style attributes will override attributes provided by a theme. `iconStyle`|`string`|"circle"| Style of expand/collapse icons. Accepted values are "circle", triangle" or "square". `indentWidth`|`integer`|4|Set the indent-width for nested objects diff --git a/index.d.ts b/index.d.ts index c1a2ce31..4dc5f584 100644 --- a/index.d.ts +++ b/index.d.ts @@ -20,6 +20,12 @@ export interface ReactJsonViewProps { * Default: "rjv-default" */ theme?: ThemeKeys | ThemeObject; + /** + * Additional `className` string to append to the `className` of react-json-view's container. + * + * Default: undefined + */ + className?: string; /** * Style attributes for react-json-view container. * Explicit style attributes will override attributes provided by a theme. diff --git a/src/js/index.js b/src/js/index.js index f47338df..4f05e242 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -53,6 +53,7 @@ class ReactJsonView extends React.PureComponent { onAdd: false, onSelect: false, iconStyle: 'triangle', + className: undefined, style: {}, validationMessage: 'Validation Error', defaultValue: null, @@ -168,11 +169,11 @@ class ReactJsonView extends React.PureComponent { name } = this.state; - const { style, defaultValue } = this.props; + const { className, style, defaultValue } = this.props; return (