Skip to content
shadcn.io
shadcn.io is not affiliated with official shadcn/ui

Shadcn JSON Tree View for React and Tailwind

Display JSON data in an interactive, expandable tree.

{ name: "John Doe", age: 30, email: "[email protected]", … }
name: "John Doe"
age: 30

Installation

bunx --bun shadcn@latest add https://kit.dev/r/json-tree-view.json

Usage

import { JsonTreeView } from "@/registry/react/components/json-tree-view";

const data = { name: "John", age: 30, address: { city: "NYC" } };

<JsonTreeView data={data} defaultExpandedDepth={1} />

Examples

Different data types

Display various JavaScript data types including objects, arrays, primitives, dates, and special values.

Controlling expand level

Use the defaultExpandedDepth prop to control how many levels are expanded by default.

Map and Set

Native JavaScript Map and Set objects are supported.

API Reference

JsonTreeView

PropTypeDefault
dataobject-
defaultExpandedDepthnumber-
renderValue(node) => ReactNode-

For a complete list of props, see the Ark UI documentation.