Components and hooks¶
H5P equivalents
LessonKit |
H5P |
|---|---|
|
Multiple Choice |
|
True/False |
|
Fill in the Blanks |
|
Drag and Drop |
|
Drag the Words |
|
Mark the Words |
|
Question Set |
|
Scenario / narrative block |
|
Open response (manual scoring) |
More types (InteractiveVideo, SlideDeck, …) are on the roadmap. See Coming from H5P? and the capability map.
Canonical block list, props, and contracts: Block catalog reference.
Components¶
Component |
Required props |
Role |
|---|---|---|
|
|
Wraps provider; course shell |
|
|
Lesson lifecycle (start/complete on mount/unmount) |
|
— |
Semantic scenario region |
|
|
MCQ assessment ( |
|
|
Two-option assessment ( |
|
|
Inline inputs; |
|
|
Inline drag targets |
|
|
Drag items to targets; keyboard alternative |
|
|
Select correct word tokens |
|
|
Question-set container; aggregates child handles |
|
optional |
Textarea reflection block |
|
— |
Shows completed lesson count |
Course accepts config for tracking/xAPI and optional sinks (same shape as LessonkitProvider).
Storybook¶
Browse published stories: Storybook on GitHub Pages.
Run the gallery locally from the monorepo:
npm run storybook
See packages/react/stories for story groups (Course/Lesson layouts, Quiz states, blocks). API index: API reference.
Hooks¶
Hook |
Returns |
|---|---|
|
Full runtime (throws outside provider) |
|
|
|
|
|
|
|
Generalized assessment lifecycle + |
|
|
|
Theme context from |
Lesson lifecycle¶
Lesson calls setActiveLesson on mount and completeLesson on unmount. SPA navigation that unmounts lessons emits completion and time-on-task events—design navigation accordingly (see examples/react-vite).
Custom interactions¶
const { track } = useTracking();
track("interaction", { kind: "branch_choice", branch: "verify" });
Use discriminated data shapes per Telemetry reference.
Provider-only usage¶
<LessonkitProvider config={{ courseId: "my-course", tracking: { sink } }}>
{/* custom tree */}
</LessonkitProvider>
Package README: @lessonkit/react on GitHub.