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
  • Segmented Control

    Segmented Control

    8
  • Agent Roster

    Agent Roster

    4
  • Table Of Contents

    Table Of Contents

    1
  • API Key Field

    API Key Field

    1
  • FAQ Accordion Section

    FAQ Accordion Section

  • Signature Pad

    Signature Pad

  • Status Dot

    Status Dot

  • Rating

    Rating

More in Navigation

View all
  • Footer with Big Wordmark

    Footer with Big Wordmark

    81
  • Liquid Glass Expandable Sidebar

    Liquid Glass Expandable Sidebar

    255
  • Button Breadcrumb

    Button Breadcrumb

    36
  • Sidebar

    Sidebar

    414
  • Astryx Breadcrumb Item

    Astryx Breadcrumb Item

  • Menu

    Menu

    27
  • Progress Bar Stepper

    Progress Bar Stepper

    64
  • Pagination

    Pagination

    14