ham7a311

Lesson Path

Navigation

About

A winding, Duolingo-style path of round lesson nodes for a course, showing finished lessons with a tick, the next lesson with a bobbing Start flag, and locked lessons greyed out, with a details card and XP reward on press.

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

Code

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

Usage.tsx

"use client";
import LessonPath from "@/components/ui/lesson-path";
import type { PathUnit } from "@/components/ui/lesson-path";
import { useState } from "react";

const UNITS: PathUnit[] = [
  {
    id: "u1",
    title: "Getting around town",
    subtitle: "Ask for directions, read signs",
    color: "green",
    lessons: [
      { id: "l1", title: "Greetings", xp: 10, state: "done" },
      { id: "l2", title: "At the market", xp: 10, state: "done" },
      { id: "l3", title: "Ordering coffee", xp: 15, state: "current" },
      { id: "l4", title: "Taking a taxi", xp: 15, state: "locked" },
      { id: "l5", title: "Unit review", xp: 20, state: "locked" },
    ],
  },
  {
    id: "u2",
    title: "Working days",
    subtitle: "Meetings, emails and small talk",
    color: "blue",
    lessons: [
      { id: "l6", title: "Introductions", xp: 10, state: "locked" },
      { id: "l7", title: "Scheduling", xp: 15, state: "locked" },
    ],
  },
];

export default function LessonPathDemo() {
  const [started, setStarted] = useState("");
  return (
    <div className="flex min-h-full w-full justify-center bg-background px-4 py-10">
      <div className="w-full max-w-[26rem]">
        <LessonPath
          units={UNITS}
          theme="light"
          onStart={(id) =>
            setStarted(
              UNITS.flatMap((u) => u.lessons).find((l) => l.id === id)?.title ??
                "",
            )
          }
        />
        <p
          role="status"
          className="mt-6 text-center text-[13px] font-bold text-muted-foreground"
        >
          {started
            ? `Demo · would open "${started}"`
            : "Press a lesson to see what it holds."}
        </p>
      </div>
    </div>
  );
}

More by ham7a311

View all
  • Wave Mesh

    Wave Mesh

    184
  • Route Globe

    Route Globe

    152
  • Glass Tiles

    Glass Tiles

    146
  • Glyph Swell

    Glyph Swell

    60
  • Orbit Ring Stats

    Orbit Ring Stats

    55
  • Ask Bar

    Ask Bar

    46
  • Intent Label

    Intent Label

    39
  • Glass Ribbons

    Glass Ribbons

    37

More in Navigation

View all
  • Liquid Glass Expandable Sidebar

    Liquid Glass Expandable Sidebar

    56
  • Footer with Big Wordmark

    Footer with Big Wordmark

    37
  • Sidebar

    Sidebar

    390
  • Oversized 404 Numeral

    Oversized 404 Numeral

    78
  • Pagination

    Pagination

    108
  • Menu

    Menu

    23
  • Astryx Breadcrumb Item

    Astryx Breadcrumb Item

    3
  • Stacked Circular Footer

    Stacked Circular Footer

    457