# Course curriculum

> A course's modules as disclosures with their lessons, durations and done, current or locked states, under an overall progress bar.

- Kind: ui · Category: Navigation · Interactivity: native
- Install: `npx shadcn@latest add @haze/course-curriculum`
- File: `src/components/haze/ui/course-curriculum.astro`
- npm dependencies: @lucide/astro
- Registry dependencies: @haze/progress, @haze/utils
- Docs page: https://hazeui.com/ui/course-curriculum

## Use when
- A course page or lesson player lists every lesson and the learner's progress
- A sales page shows what a course covers, module by module

## Avoid when
- Steps must be done in one sitting in a fixed order. Use stepper.
- The list is a page's own headings. Use table-of-contents.

## Alternatives
- [accordion](https://hazeui.com/ui/accordion.md)
- [stepper](https://hazeui.com/ui/stepper.md)
- [table-of-contents](https://hazeui.com/ui/table-of-contents.md)

## Props

| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| title | `string` | "Prompting for small business" | no | Visible title, usually the course name. |
| modules | `{ title: string; lessons: { title: string; duration?: string; state?: "done" \| "current" \| "open" \| "locked"; href?: string }[] }[]` |  | no | Modules in order with their lessons. |
| stateLabels | `Partial<Record<LessonState, string>>` |  | no | Words read for each lesson state. |
| headingLevel | `2 \| 3 \| 4` | 3 | no | Level of the title. |
| class | `string` |  | no | Additional classes on the panel. |

## Accessibility
- Modules are native disclosures; the one holding the current lesson starts open.
- Every lesson's state is read after its title, and the current lesson is marked with aria-current.
- Key Enter or Space: Open or close a module.
- Key Tab: Move between lessons.

## Agent prompts

### Install and use

Install the Haze UI component "Course curriculum" with `npx shadcn@latest add @haze/course-curriculum`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "https://hazeui.com/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import CourseCurriculum from "@/components/haze/ui/course-curriculum.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: https://hazeui.com/ui/course-curriculum.md

### Customize with real content

Adapt the Haze course-curriculum ui for our product. Replace the demo values of these props with our real content: title, modules, stateLabels, headingLevel, class. Keep the layout, the heading level rules and these accessibility details: Modules are native disclosures; the one holding the current lesson starts open. Every lesson's state is read after its title, and the current lesson is marked with aria-current. Do not add raw color classes; use the Haze tokens.

### Choose the right block

Before using course-curriculum, check it fits: use it when a course page or lesson player lists every lesson and the learner's progress; a sales page shows what a course covers, module by module. Avoid it when steps must be done in one sitting in a fixed order. use stepper.; the list is a page's own headings. use table-of-contents.. Alternatives: @haze/accordion, @haze/stepper, @haze/table-of-contents.

## Example requests that should lead here
- Add the course outline with three modules, finished lessons checked and later lessons locked.

## Source

```astro
---
import { ChevronDown, CircleCheck, CirclePlay, Lock } from "@lucide/astro";
import { cn } from "../../../lib/haze/utils";
import Progress from "./progress.astro";

type LessonState = "done" | "current" | "open" | "locked";

interface Lesson {
  title: string;
  /** Length as it should read, such as "8 min". */
  duration?: string;
  state?: LessonState;
  href?: string;
}

interface Module {
  title: string;
  lessons: Lesson[];
}

interface Props {
  /** Visible title, such as the course name. */
  title?: string;
  modules?: Module[];
  /** Words for each lesson state, read after the title. */
  stateLabels?: Partial<Record<LessonState, string>>;
  headingLevel?: 2 | 3 | 4;
  class?: string;
}

const {
  title = "Prompting for small business",
  modules = [
    {
      title: "Getting started",
      lessons: [
        { title: "What an assistant can and cannot do", duration: "6 min", state: "done", href: "#l1" },
        { title: "Your first useful prompt", duration: "9 min", state: "done", href: "#l2" },
        { title: "Giving it your price list and FAQ", duration: "11 min", state: "done", href: "#l3" },
      ],
    },
    {
      title: "Writing with it every day",
      lessons: [
        { title: "Replies to customer emails", duration: "8 min", state: "done", href: "#l4" },
        { title: "Offers and quotes in your voice", duration: "12 min", state: "current", href: "#l5" },
        { title: "Checking facts before you send", duration: "7 min", state: "open", href: "#l6" },
      ],
    },
    {
      title: "Automating the busywork",
      lessons: [
        { title: "Sorting the inbox", duration: "10 min", state: "locked" },
        { title: "Weekly reports from a spreadsheet", duration: "14 min", state: "locked" },
      ],
    },
  ],
  stateLabels = {},
  headingLevel = 3,
  class: className,
} = Astro.props;

const H = `h${headingLevel}` as "h3";
const labels: Record<LessonState, string> = { done: "completed", current: "in progress", open: "not started", locked: "locked", ...stateLabels };
const all = modules.flatMap((m) => m.lessons);
const done = all.filter((l) => l.state === "done").length;
---

<section aria-label={title} class={cn("overflow-hidden rounded-xl border border-border bg-card", className)}>
  <div class="border-b border-border px-4 py-3">
    <H class="text-[0.9375rem]/5 font-medium tracking-[-0.01em] text-foreground">{title}</H>
    <p class="mt-0.5 text-[0.8125rem]/5 text-muted-foreground tabular-nums">{done} of {all.length} lessons done</p>
    <Progress label={`${title} progress`} hideLabel value={done} max={all.length || 1} size="sm" class="mt-2.5" />
  </div>
  <div class="divide-y divide-border">
    {
      modules.map((mod, i) => {
        const modDone = mod.lessons.filter((l) => l.state === "done").length;
        const active = mod.lessons.some((l) => l.state === "current");
        return (
          <details open={active} class="group">
            <summary class="flex cursor-pointer list-none items-center gap-3 px-4 py-3 transition-colors duration-150 ease-snappy hover:bg-accent focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring [&::-webkit-details-marker]:hidden">
              <span class="w-5 text-[0.8125rem]/5 text-muted-foreground tabular-nums">{String(i + 1).padStart(2, "0")}</span>
              <span class="min-w-0 flex-1 text-[0.8125rem]/5 font-medium text-foreground">{mod.title}</span>
              <span class="text-[0.8125rem]/5 text-muted-foreground tabular-nums">
                {modDone}/{mod.lessons.length}
              </span>
              <ChevronDown aria-hidden="true" class="size-4 text-muted-foreground transition-[rotate] duration-200 ease-snappy group-open:rotate-180" />
            </summary>
            <ul role="list" class="pb-2">
              {mod.lessons.map((lesson) => {
                const state = lesson.state ?? "open";
                const Icon = state === "done" ? CircleCheck : state === "locked" ? Lock : CirclePlay;
                const tone = state === "done" ? "text-success" : state === "current" ? "text-foreground" : "text-muted-foreground";
                const inner = (
                  <>
                    <Icon aria-hidden="true" class={cn("size-4 shrink-0", tone)} />
                    <span class={cn("min-w-0 flex-1", state === "locked" ? "text-muted-foreground" : "text-foreground", state === "current" && "font-medium")}>
                      {lesson.title}
                      <span class="sr-only">, {labels[state]}</span>
                    </span>
                    {lesson.duration && <span class="text-[0.8125rem]/5 text-muted-foreground tabular-nums">{lesson.duration}</span>}
                  </>
                );
                return (
                  <li>
                    {lesson.href && state !== "locked" ? (
                      <a
                        href={lesson.href}
                        aria-current={state === "current" ? "step" : undefined}
                        class="mx-2 flex items-center gap-3 rounded-md px-2 py-2 text-[0.8125rem]/5 transition-colors duration-150 ease-snappy hover:bg-accent focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring aria-[current=step]:bg-accent"
                      >
                        {inner}
                      </a>
                    ) : (
                      <div class="mx-2 flex items-center gap-3 px-2 py-2 text-[0.8125rem]/5">{inner}</div>
                    )}
                  </li>
                );
              })}
            </ul>
          </details>
        );
      })
    }
  </div>
</section>
```
