diff --git a/apps/design-system/app/(app)/docs/[[...slug]]/page.tsx b/apps/design-system/app/(app)/docs/[[...slug]]/page.tsx
index f4e4c6694d9..f3cdccc24d5 100644
--- a/apps/design-system/app/(app)/docs/[[...slug]]/page.tsx
+++ b/apps/design-system/app/(app)/docs/[[...slug]]/page.tsx
@@ -1,5 +1,5 @@
import { Mdx } from '@/components/mdx-components'
-import { DocsPager } from '@/components/pager'
+import { DocsPager, getBreadcrumbSegments } from '@/components/pager'
import { SourcePanel } from '@/components/source-panel'
import { DashboardTableOfContents } from '@/components/toc'
import { siteConfig } from '@/config/site'
@@ -12,6 +12,7 @@ import '@/styles/mdx.css'
import { allDocs } from 'contentlayer/generated'
import { ChevronRight } from 'lucide-react'
import type { Metadata } from 'next'
+import Link from 'next/link'
import { notFound } from 'next/navigation'
import Balancer from 'react-wrap-balancer'
import { ScrollArea, Separator } from 'ui'
@@ -83,15 +84,39 @@ export default async function DocPage(props: DocPageProps) {
}
const toc = await getTableOfContents(doc.body.raw)
+ const breadcrumbSegments = getBreadcrumbSegments(doc)
return (
-
+
{doc.title}
{doc.description && (
diff --git a/apps/design-system/components/pager.tsx b/apps/design-system/components/pager.tsx
index b5c6eb39a0d..b7b1620b8ea 100644
--- a/apps/design-system/components/pager.tsx
+++ b/apps/design-system/components/pager.tsx
@@ -71,3 +71,27 @@ export function flatten(links: NavItemWithChildren[]): NavItem[] {
}, [])
.filter((link) => !link?.disabled)
}
+
+export interface BreadcrumbSegment {
+ title: string
+ href?: string
+}
+
+export function getBreadcrumbSegments(doc: Doc): BreadcrumbSegment[] {
+ const segments: BreadcrumbSegment[] = [{ title: 'Docs', href: '/docs' }]
+
+ for (const section of docsConfig.sidebarNav) {
+ const flatItems = flatten(section.items ?? [])
+ const inSection = flatItems.some((item) => item.href === doc.slug)
+ if (!inSection || !section.title) continue
+
+ const sectionLanding = flatItems.find((item) => item.priority) ?? flatItems[0]
+ const isOnLanding = sectionLanding?.href === doc.slug
+ if (sectionLanding?.href && !isOnLanding) {
+ segments.push({ title: section.title, href: sectionLanding.href })
+ }
+ break
+ }
+
+ return segments
+}