About
Sticky in-page navigation tabs that highlight the section the reader has scrolled to with a sliding indicator, keep the active tab in view on narrow screens, and smoothly scroll to a section when clicked.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Section Tabs to your project and fits it to your theme.
Code
How Section Tabs is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client";
import * as React from "react";
import SectionTabs from "@/components/ui/section-tabs";
const sections = [
{ id: "st-overview", label: "Overview" },
{ id: "st-features", label: "Features" },
{ id: "st-pricing", label: "Pricing" },
{ id: "st-faq", label: "FAQ" },
];
export default function SectionTabsDemo() {
const scroller = React.useRef<HTMLDivElement>(null);
return (
<div
ref={scroller}
className="h-80 w-full max-w-2xl overflow-auto rounded-xl border bg-background shadow-sm"
>
<SectionTabs sections={sections} container={scroller} offset={56} />
{sections.map((s, i) => (
<section
key={s.id}
id={s.id}
className="grid min-h-56 content-start gap-2 border-b p-6 last:border-b-0"
>
<h2 className="text-xl font-semibold tracking-tight">{s.label}</h2>
<p className="max-w-prose text-sm text-muted-foreground">
Section {i + 1}. The tab bar sticks to the top, follows your
position and scrolls to a section when you choose its tab.
</p>
</section>
))}
<div className="h-32" aria-hidden="true" />
</div>
);
}
















