sona-ui

Section Rail

Navigation

About

A compact navigation rail that tracks the reader's position through a long page, revealing labels and editorial context cards on hover and focus.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Section Rail to your project and fits it to your theme.

Code

How Section Rail is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client"

import { useRef } from "react"
import SectionRail from "@/components/ui/sona-section-rail"

const sections = [
  {
    id: "section-rail-demo-overview",
    label: "Overview",
    description: "The goal, scope, and main ideas behind this page.",
  },
  {
    id: "section-rail-demo-interaction",
    label: "Interaction",
    description: "How the component responds to hover, focus, and scroll.",
  },
  {
    id: "section-rail-demo-motion",
    label: "Motion",
    description: "Direct scroll progress, no bounce, no ambient animation.",
  },
  {
    id: "section-rail-demo-accessibility",
    label: "Accessibility",
    description: "Labels on focus, aria-current, and reduced-motion support.",
  },
];

const copy =
  "A rail answers three questions at a glance: where am I, what is nearby, and where can I go. Everything else is decoration.";

export default function SectionRailDemo() {
  const scrollRef = useRef<HTMLDivElement>(null);

  return (
    <div className="flex w-full max-w-2xl items-stretch gap-6">
      <div
        ref={scrollRef}
        className="h-80 flex-1 overflow-y-auto rounded-xl border border-border bg-secondary/40 p-6"
      >
        {sections.map((section) => (
          <section
            key={section.id}
            id={section.id}
            className="scroll-mt-6 py-10"
          >
            <h3 className="font-semibold text-foreground text-lg">
              {section.label}
            </h3>
            <p className="mt-2 text-muted-foreground text-sm leading-relaxed">
              {section.description} {copy}
            </p>
          </section>
        ))}
      </div>

      <div className="flex items-center">
        <SectionRail
          items={sections}
          scrollRoot={scrollRef}
          scrollOffset={24}
          side="left"
        />
      </div>
    </div>
  );
}

Dependencies

More by sona-ui

View all
  • Stagger Text

    Stagger Text

    8
  • Dot Orbit Shader

    Dot Orbit Shader

  • Mesh Gradient Shader

    Mesh Gradient Shader

  • Split Text

    Split Text

  • Image Trail

    Image Trail

  • Activity Graph

    Activity Graph

  • Fluid Slider

    Fluid Slider

  • Lightbox

    Lightbox

More in Navigation

View all
  • Footer with Big Wordmark

    Footer with Big Wordmark

    179
  • Liquid Glass Expandable Sidebar

    Liquid Glass Expandable Sidebar

    457
  • Meniscus — Liquid Bottom Navigation Bar

    Meniscus — Liquid Bottom Navigation Bar

    40
  • Sidebar

    Sidebar

    445
  • Tabs

    Tabs

    38
  • Stacked Circular Footer

    Stacked Circular Footer

    471
  • Footer

    Footer

    470
  • Sidebar

    Sidebar

    367