@@ -150,71 +150,6 @@ export default function Demo() {
150
150
}
151
151
```
152
152
153
- Inspector
154
-
155
- ``` tsx mdx:preview
156
- import React from ' react' ;
157
- import JsonView from ' @uiw/react-json-view' ;
158
-
159
- const object = [
160
- {
161
- " _id" : " 56dcf573b09c217d39fd7621" ,
162
- " name" : " Howard Christensen" ,
163
-
164
- " phone" : " +1 (830) 529-3176" ,
165
- " address" : " 511 Royce Street, Hilltop, Tennessee, 9712"
166
- },
167
- {
168
- " _id" : " 56dcf57323630b06251e93cd" ,
169
- " name" : " Eleanor Lynn" ,
170
-
171
- " phone" : " +1 (911) 576-2345" ,
172
- " address" : " 547 Dearborn Court, Trona, California, 8629"
173
- },
174
- {
175
- " _id" : " 56dcf5738279cac6b081e512" ,
176
- " name" : " Baxter Mooney" ,
177
-
178
- " phone" : " +1 (954) 456-3456" ,
179
- " address" : " 349 Cumberland Walk, Washington, Alaska, 3154"
180
- },
181
- {
182
- " _id" : " 56dcf57303accabd43740957" ,
183
- " name" : " Calhoun Tyson" ,
184
-
185
- " phone" : " +1 (818) 456-2529" ,
186
- " address" : " 367 Lyme Avenue, Ladera, Louisiana, 6292"
187
- },
188
- {
189
- " _id" : " 56dcf57391ea6a9d1f60df0c" ,
190
- " name" : " Judith Jimenez" ,
191
-
192
- " phone" : " +1 (950) 587-3415" ,
193
- " address" : " 269 Bogart Street, Sultana, Vermont, 7833"
194
- },
195
- {
196
- " _id" : " 56dcf5735a7a0718a61f294d" ,
197
- " name" : " Newman Lawson" ,
198
-
199
- " phone" : " +1 (814) 484-2827" ,
200
- " address" : " 969 Conduit Boulevard, Lowell, Oregon, 4118"
201
- }
202
- ]
203
-
204
- const customTheme = {
205
- ' --w-rjv-background-color' : ' #fff' ,
206
- ' --w-rjv-border-left-width' : 0 ,
207
- ' --w-rjv-color' : ' #881391' ,
208
- ' --w-rjv-type-int-color' : ' #881391' ,
209
- };
210
-
211
- export default function Demo() {
212
- return (
213
- <JsonView value = { object } style = { customTheme } quotes = " " displayDataTypes = { false } enableClipboard = { false } />
214
- )
215
- }
216
- ```
217
-
218
153
## Online Editing Theme
219
154
220
155
Online custom style example, please check in the [ documentation website] ( https://uiwjs.github.io/react-json-view/ )
@@ -465,6 +400,79 @@ export default function Demo() {
465
400
}
466
401
```
467
402
403
+ Inspector
404
+
405
+ ``` tsx mdx:preview
406
+ import React from ' react' ;
407
+ import JsonView from ' @uiw/react-json-view' ;
408
+
409
+ const object = [
410
+ {
411
+ " _id" : " 56dcf573b09c217d39fd7621" ,
412
+ " name" : " Howard Christensen" ,
413
+
414
+ " phone" : " +1 (830) 529-3176" ,
415
+ " address" : " 511 Royce Street, Hilltop, Tennessee, 9712"
416
+ },
417
+ {
418
+ " _id" : " 56dcf57323630b06251e93cd" ,
419
+ " name" : " Eleanor Lynn" ,
420
+
421
+ " phone" : " +1 (911) 576-2345" ,
422
+ " address" : " 547 Dearborn Court, Trona, California, 8629"
423
+ },
424
+ {
425
+ " _id" : " 56dcf5738279cac6b081e512" ,
426
+ " name" : " Baxter Mooney" ,
427
+
428
+ " phone" : " +1 (954) 456-3456" ,
429
+ " address" : " 349 Cumberland Walk, Washington, Alaska, 3154"
430
+ },
431
+ {
432
+ " _id" : " 56dcf57303accabd43740957" ,
433
+ " name" : " Calhoun Tyson" ,
434
+
435
+ " phone" : " +1 (818) 456-2529" ,
436
+ " address" : " 367 Lyme Avenue, Ladera, Louisiana, 6292"
437
+ },
438
+ ]
439
+
440
+ const customTheme = {
441
+ ' --w-rjv-background-color' : ' #fff' ,
442
+ ' --w-rjv-border-left-width' : 0 ,
443
+ ' --w-rjv-color' : ' #881391' ,
444
+ ' --w-rjv-type-int-color' : ' #881391' ,
445
+ };
446
+
447
+ export default function Demo() {
448
+ return (
449
+ <JsonView
450
+ value = { object }
451
+ style = { customTheme }
452
+ quotes = " "
453
+ enableClipboard = { false }
454
+ displayDataTypes = { false }
455
+ components = { {
456
+ braces : ({ level }) => level !== 1 && <span />,
457
+ countInfo : ({ level , count , visible }) => {
458
+ if (level === 1 ) {
459
+ return <span />;
460
+ // return visible ? <span>{Array.from({ length: 3 }, () => 'Object').join(', ')}</span> : <span />
461
+ }
462
+ return <span style = { { color: ' #222' }} >Object</span >;
463
+ },
464
+ ellipsis : ({ level , count }) => {
465
+ if (level === 1 ) {
466
+ return <span >{ Array .from ({ length: 3 }, () => ' Object' ).join (' , ' )} </span >;
467
+ }
468
+ return <span />;
469
+ },
470
+ }}
471
+ />
472
+ );
473
+ }
474
+ ```
475
+
468
476
## Editor JSON
469
477
470
478
``` tsx mdx:preview
0 commit comments