Dev Helpers
← Back

Versioned documentation header

Place this file at app/docs/[[...parts]]/page.tsx in an App Router project.

Open this example in the interactive library

Source code

// app/docs/[[...parts]]/page.tsx

export default async function VersionedDocumentationHeader({
  params,
}: {
  params: Promise<{ parts?: string[] }>;
}) {
  const { parts = [] } = await params;
  const [version, ...topic] = parts;
  return (
    <header>
      <small>Edition: {version ?? "latest"}</small>
      <h1>{topic.join(" / ") || "Documentation"}</h1>
    </header>
  );
}