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 "@/components/ui/json-tree-view";
const data = {
  name: "John Doe",
  age: 30,
  email: "[email protected]",
  address: {
    street: "123 Main St",
    city: "Anytown",
    state: "CA",
    zip: "12345",
  },
};

const Example = () => (
  <div className="w-full max-w-md">
    <JsonTreeView data={data} defaultExpandedDepth={1} />
  </div>
);

Demos

Data Types

Expand Depth

Map Set

API Reference

JsonTreeView

PropType
AttributeType
CSS variableType