Open this example in the interactive library
Source code
"use client";
// components/ActiveSubsectionSummary.tsx
import { useSelectedLayoutSegments } from "next/navigation";
export default function ActiveSubsectionSummary() {
const segments = useSelectedLayoutSegments().filter((s) => !s.startsWith("("));
return (
<p>{segments.length ? segments.join(" / ") : "You are at the section root."}</p>
);
}
