Json Viewer
A collapsible JSON tree for React with syntax coloured values, item counts on folded nodes, copy value and copy path buttons, search highlighting and arrow key navigation.
src/registry/ui/json-viewer.tsx/r/json-viewer.json
Installation#
bash
npx shadcn@latest add @minidev/json-viewer
MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/json-viewer.json
Usage#
tsx
import { JsonViewer } from "@/components/ui/json-viewer"
export function Example() {
return (
<JsonViewer value={{ name: "minidev-ui", items: 300 }} />
)
}
API reference#
| Prop | Type | Default |
|---|---|---|
value | unknown | SAMPLE |
title | string | "GET /v1/invoices/inv_8f3a2c" |
rootName | string | "" |
defaultExpandDepth | number | 1 |
defaultExpanded | string[] | ["$.customer", "$.lines", "$.lines[0]"] |
toolbar | boolean | true |
maxStringLength | number | 64 |
onCopy | (text: string, kind: "value" | "path", path: string) => void | - |
aria-label | string | - |
className | string | - |
Dependencies#
npm
lucide-react
Built from
No other MiniDev files
Examples#
Related dev tools components#
Api Key ListReact settings panel listing API keys with masked previews, created date badges and a rotate button per key, plus a header action to create a new key.Build PipelineCI pipeline view that shows each stage as a chip with success, running, failed or pending icons, joined by connectors. Status text is exposed to screen readers.Check Run ListList of CI check runs with success, failed or running icons, monospaced job names and a status label. Looks like the checks section of a pull request.Code BlockReact code block with zero dependency syntax coloring, a language tag, optional filename and line numbers, and a copy button that confirms Copied.Code Editor FrameEditor style frame with a monospaced filename tab and a code area. Wrap snippets, editors or diffs so they read as a file in your React docs or app.Commit RowGit commit row for React with author avatar, commit message, relative time, a short SHA badge and a copy button for the hash. Fits deploy logs.
All Developer tool UI components for React