A JSON viewer with depth rails, previews on closed branches, search across keys and values that opens every ancestor of a match and steps between them, and the selected path to copy.
pnpm dlx shadcn@latest add @beautiful-ui-pro/json-viewerNeeds your registry key. Your components.json style picks the Base UI or Radix build: radix-*, new-york and default get Radix, base-* gets Base UI.
The CLI adds the styles to the CSS file named in components.json (tailwind.css). Check that it points at your global stylesheet, that the project uses Tailwind CSS v4, and that the file is imported in your root layout. Installed by hand: paste styles.css into that file.
Import it and pass your content. The props that matter most are listed next.
import { JsonViewer } from "@/components/ui/notchset/json-viewer";
const response = {
id: "run_8f3a1",
agent: "planner",
status: "ok",
latency_ms: 2104,
tools: [{ name: "search_docs", calls: 3 }, { name: "run_sql", calls: 1 }],
usage: { input_tokens: 1820, output_tokens: 412 },
};
export function RunResponse() {
return <JsonViewer data={response} rootKey="run" defaultDepth={2} />;
}data–
unknownAny JSON value.
rootKey–
stringThe root's name, and the start of each path.
header–
ReactNodeA line above the search (the request).
defaultExpanded / defaultDepth–
string[] / numberWhat starts open.
defaultSelected–
stringA path like run.usage.cost_usd.
height–
numberThe scroll area (312px).
components/ui/notchset/json-viewer.tsx
This component is included with Pro.
Try the live preview above. Get Pro to install the source.