esc
navigate select

Async Tree

Children are fetched on first expand — this demo simulates a network round-trip with a 600ms delay.

Show code
const data = [{ id: "root", label: "Remote Drive", hasChildren: true }];

async function fetchChildren(node) {
  const res = await fetch(`/api/files/${node.id}`);
  if (!res.ok) throw new Error("Failed to load");
  return res.json();
}

<TreeKit data={data} onLoadChildren={fetchChildren} />

Expand "Remote Drive" to see the loading spinner, then drill into "Documents" or "Taxes" — each level loads independently. Full behavior, including error/retry, in Async Loading.