Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

sticky behaviour of TableOfContent (#600)

Prakash Kumar singh3a6e29819f92
diff --git a/app/(docs)/docs/[[...slug]]/page.tsx b/app/(docs)/docs/[[...slug]]/page.tsx
index e8fdd388..e0e73418 100644
--- a/app/(docs)/docs/[[...slug]]/page.tsx
+++ b/app/(docs)/docs/[[...slug]]/page.tsx
@@ -1,7 +1,6 @@
import { Mdx } from "@/components/mdx-components";
import { DocPager } from "@/components/pager";
import { badgeVariants } from "@/components/ui/badge";
-import { ScrollArea } from "@/components/ui/scroll-area";
import { getTableOfContents } from "@/lib/toc";
import { absoluteUrl, cn } from "@/lib/utils";
@@ -135,13 +134,11 @@ export default async function DocPage({ params }: DocPageProps) {
<DocPager doc={doc} />
</div>
{doc.toc && (
- <div className="hidden border-l border-border py-6 pl-6 text-sm lg:py-8 xl:block">
- <ScrollArea className="pb-10">
- <div className="sticky top-16 -mt-10 h-[calc(100vh-3.5rem)] space-y-4 py-12">
- <TableOfContents toc={toc} />
- <Contribute doc={doc} />
- </div>
- </ScrollArea>
+ <div className="hidden border-l border-border py-6 pl-6 text-sm xl:block">
+ <div className="sticky top-[90px] h-[calc(100vh-3.5rem)] space-y-4">
+ <TableOfContents toc={toc} />
+ <Contribute doc={doc} />
+ </div>
</div>
)}
</main>