vamsiy78

Section Tabs

Navigation

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>
  );
}

Dependencies

More by vamsiy78

View all
  • Animated Beam

    Animated Beam

    53
  • Glow Border

    Glow Border

    16
  • Agent Roster

    Agent Roster

    13
  • Segmented Control

    Segmented Control

    12
  • FAQ Accordion Section

    FAQ Accordion Section

    3
  • API Key Field

    API Key Field

    3
  • Signature Pad

    Signature Pad

    1
  • Table Of Contents

    Table Of Contents

    1

More in Navigation

View all
  • Footer with Big Wordmark

    Footer with Big Wordmark

    169
  • Liquid Glass Expandable Sidebar

    Liquid Glass Expandable Sidebar

    442
  • Meniscus — Liquid Bottom Navigation Bar

    Meniscus — Liquid Bottom Navigation Bar

    33
  • Sidebar

    Sidebar

    444
  • Tabs

    Tabs

    38
  • Pagination

    Pagination

    121
  • Sidebar

    Sidebar

    367
  • Stacked Circular Footer

    Stacked Circular Footer

    470