Open this example in the interactive library
Source code
"use client";
// components/LayoutDepthIndicator.tsx
import { useSelectedLayoutSegments } from "next/navigation";
export default function LayoutDepthIndicator() {
const segments = useSelectedLayoutSegments().filter((s) => !s.startsWith("("));
return (
<small>
{segments.length
? segments.length + " levels below this layout"
: "Section overview"}
</small>
);
}
