Skip to content
Data Display

Json Viewer

Collapsible JSON tree with type-colored values and per-row copy.

Import

tsx
import { JsonViewer } from "@cooud-ui/ui";
bash
npx cooud-ui add json-viewer

Examples

API Reference

Generated from the component's exported types.

JsonViewerProps

Extends HTMLAttributes<HTMLDivElement>

Skip JsonViewerProps props table
PropTypeDefaultDescription
data*
unknownThe value to render. Objects and arrays become collapsible branches.
defaultExpandedDepth
number1How 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.