Code Block
JSON Tree
JSON with expandable nested nodes: every object and array is a native details element, and a collapsed branch shows how many fields it holds.
React + Tailwind, shadcn-compatible: press “Copy for AI” and your Cursor or Claude Code agent installs it with the shadcn CLI.
What you can change
- the payload through data
- the file caption through rootLabel
- the initial expansion depth through openDepth
A link for your AI agent: preview, code and instructions.
Preview

Use it with AI
- 1. Copy the link.
- 2. Write to your agent in your own words and drop the link into the sentence.
- 3. The agent opens the link and installs the component from the registry.
put this on the home page as the hero:
https://vibeui.club/c/codeblock-021?lang=en&theme=dark
Not sure where to paste it? Step-by-step guide
Show the full instructions
What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.
Loading…
How to use
<Codeblock021
rootLabel="response"
openDepth={2}
/>A sample call. The agent installs the component itself from the registry via the “Copy for AI” link.
Settings
- Payload name
rootLabel· default: response- Expanded depth
openDepth· default: 2- Background
background· default: theme colour
More in Code Block
FAQ
- How do I add JSON Tree with Cursor or Claude Code?
- Press “Copy for AI” on this page and paste it into your agent's chat. The instruction contains the shadcn CLI install command, the dependencies and what to keep, so the agent installs this exact component instead of recreating a lookalike.
- What does JSON Tree depend on?
- No npm packages beyond React and Tailwind CSS.
- What can I change in JSON Tree?
- Adapt: the payload through data; the file caption through rootLabel; the initial expansion depth through openDepth. Keep as installed: the local --vibeui-codeblock-021-* palette — do not swap it for your theme tokens; the native details: it gives expansion, find-in-page and no-JS behaviour for free; the field counter on a collapsed node — otherwise a closed branch looks like an empty one.
- Is JSON Tree free?
- Yes. The preview is open without an account; with a free account you can copy up to 20 components a month.
For developers
npx shadcn@latest add https://vibeui.club/r/pro/codeblock-021.jsonThis command needs a signed link: sign in and open “Component source” below — it issues a working link valid for 30 minutes. All install options
Technical notes
The component is self-contained: one file, zero dependencies, its own palette in the local --vibeui-codeblock-021-* variables. Server component: the expansion is done by native details, the tree state is not kept in JS. The nodes are drawn by a recursive internal function: a primitive becomes a line with a token chosen by value type, while an object or an array becomes a details with a summary, a field count and a trailing bracket that is visible only when collapsed. The commas are derived from the element's position, so the tree always looks like valid JSON. The initial expansion depth is set by the openDepth prop and compared with the node level.
Tags
- json
- tree
- details
- no-js
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
Loading…