Open this example in the interactive library
Source code
"use client";
// components/DashboardOverviewIndicator.tsx
import Link from "next/link";
import { useSelectedLayoutSegment } from "next/navigation";
export default function DashboardOverviewIndicator({
base = "/dashboard",
}: { base?: string } = {}) {
const segment = useSelectedLayoutSegment();
return (
<Link href={base} aria-current={segment === null ? "page" : undefined}>
Overview
</Link>
);
}
