Json Viewer
Collapsible JSON tree with type-colored values and per-row copy.
Import
import { JsonViewer } from "@cooud-ui/ui";
npx cooud-ui add json-viewer
Examples
API Reference
Generated from the component's exported types.
JsonViewerProps
Extends HTMLAttributes<HTMLDivElement>
| Prop | Type | Default | Description |
|---|---|---|---|
data* | unknown | — | The value to render. Objects and arrays become collapsible branches. |
defaultExpandedDepth | number | 1 | How many levels start expanded — a mount-time default, not a controlled value. Expansion state is uncontrolled per branch and seeded once when a branch first mounts, so later changes to this prop leave already-mounted branches untouched. The root value is depth 0, so the default of 1 shows the root's entries with every nested branch collapsed. Pass `Number.POSITIVE_INFINITY` to expand everything. |