Gathering detailed insights and metrics for react18-json-view-custom
Gathering detailed insights and metrics for react18-json-view-custom
Gathering detailed insights and metrics for react18-json-view-custom
Gathering detailed insights and metrics for react18-json-view-custom
npm install react18-json-view-custom
Typescript
Module System
Node Version
NPM Version
74.5
Supply Chain
99.1
Quality
75.3
Maintenance
100
Vulnerability
100
License
TypeScript (93.87%)
CSS (4.39%)
JavaScript (1.74%)
Total Downloads
2,813
Last Day
1
Last Week
9
Last Month
30
Last Year
1,250
MIT License
180 Commits
1 Watchers
4 Branches
1 Contributors
Updated on Mar 19, 2024
Minified
Minified + Gzipped
Latest Version
0.2.9-1
Package Id
react18-json-view-custom@0.2.9-1
Unpacked Size
382.03 kB
Size
74.97 kB
File Count
47
NPM Version
9.6.7
Node Version
18.17.0
Published on
Mar 28, 2024
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
12.5%
9
Compared to previous week
Last Month
-6.3%
30
Compared to previous month
Last Year
-20%
1,250
Compared to previous year
1
30
React function component for displaying javascript arrays and JSON objects. Supports all JS types.
1npm i react18-json-view
1npm i react18-json-view@canary
1import JsonView from 'react18-json-view' 2import 'react18-json-view/src/style.css' 3// If dark mode is needed, import `dark.css`. 4// import 'react18-json-view/src/dark.css' 5 6<JsonView src={my_json_object} /> 7 8// If needed, you can use the internal stringify function. 9// import { stringify } from 'react18-json-view' 10
Name | Type | Default | Description |
---|---|---|---|
src | JSON Object | None | This property contains your input JSON |
className | string | None | The CSS class name(s) to apply to the component. |
style | JSON Object | None | An object containing custom style rules to apply to the component. |
dark | boolean | false | Keep in dark mode (Don't forget to import dark.css ) |
theme | default | a11y | github | vscode | atom |winter-is-coming | 'default' | Color theme |
enableClipboard | boolean | true | Whether enable clipboard feature. |
matchesURL | boolean | true | Show the link icon if value is string and matches URL regex pattern. |
urlRegExp | RegExp | /^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/ | URL RegExp pattern. |
displaySize | boolean | integer | 'collapsed' | 'expanded' | false | Whether display the size of Object , Array . |
collapseStringsAfterLength | integer | 99 | When an integer value is assigned, strings longer than that length will be truncated and indicated by an ellipsis. To expand or collapse the string content, simply click on the string value. |
customizeCollapseStringUI | (str_show: string, truncated: boolean) => (JSX.Element | string) | string | - | Customize the collapse string UI. |
ignoreLargeArray (canary) | boolean | false | Prevent collapsing large array(length > 100) behavior since v0.2.7 |
collapseStringMode | 'directly' | 'word' | 'address' | 'directly' | If the word is assigned, the collapsed length will be adjusted to fully display the last word.(English only) |
collapsed | boolean | integer | function | false | When set to true(false), all nodes will be (not) collapsed by default. When using an integer value, it will collapse at a specific depth. The collapsed also can be a function. |
collapseObjectsAfterLength | integer | 99 | When an integer value is assigned, the object and array will initially collapse. |
editable | boolean | {add?: boolean , edit?: boolean , delete?: boolean } | false | When set to true, you can add, edit, or delete the property, and the actions will trigger onAdd, onEdit, or onDelete. Options is available. |
onAdd | function | - | (params: { indexOrName: string| number, depth: number, src: any; parentType: 'object' | 'array' }) => void |
onDelete | function | - | (params:{ value: any,indexOrName: string | number,depth: number,src: any,parentType: 'object' | 'array'}) => void |
onEdit | function | - | (params: { newValue: any, oldValue: any, depth: number, src: any, indexOrName: string | number, parentType: 'object' | 'array'}) => void |
customizeNode | ReactElement |ReactComponent |Options | - | Highly customize every node. |
customizeCopy | (node: any) => any | internal stringify | Customize copy behavior, only the returned non-empty string will be written to clipboard. |
1(params: { 2 node: Record<string, any> | Array<any> // Object or array 3 indexOrName: number | string | undefined 4 depth: number 5 size: number // Object's size or array's length 6 }) => boolean
1{ 2 add?: boolean 3 edit?: boolean 4 delete?: boolean 5}
1(params: { node: any; indexOrName: number | string | undefined; depth: number }) => 2 | { 3 add?: boolean 4 edit?: boolean 5 delete?: boolean 6 enableClipboard?: boolean 7 collapsed?: boolean 8 className?: string 9 } 10 | React.FC 11 | typeof React.Component 12 | React.ReactElement<any, any>
The editor uses eval(<input-value>)
. While in edit mode, you can enter ({})
or ([])
, which will cause the result of eval to become a new object or array.
canary:
{}
and[]
will be auto convert to({})
,([])
This component does not perform any cloning operations, so every step of the operation is carried out on the original object. If cloning is required, please handle it yourself.
When element is editable:
Ctrl/Cmd+Click
=> Edit ModeEnter
=> SubmitEsc
=> CancelBelow are the default theme variables that you can easily customize to fit your needs.
1.json-view { 2 color: #4d4d4d; 3 --json-property: #009033; 4 --json-index: #676dff; 5 --json-number: #676dff; 6 --json-string: #b2762e; 7 --json-boolean: #dc155e; 8 --json-null: #dc155e; 9} 10.json-view .json-view--property { color: var(--json-property); } 11.json-view .json-view--index { color: var(--json-index); } 12.json-view .json-view--number { color: var(--json-number); } 13.json-view .json-view--string { color: var(--json-string); } 14.json-view .json-view--boolean { color: var(--json-boolean); } 15.json-view .json-view--null { color: var(--json-null); }
react-json-view does not support React 18.
stringify
No vulnerabilities found.
No security vulnerabilities found.