Components and hooks¶
Guides vs reference
Guides (this page) explain how to use components in a course. Reference docs hold contracts and machine-readable schemas: Block catalog (includes generated prop tables), Component pages (live demos + when to use each block), and TypeDoc signatures. Start here for workflows; open reference when implementing or validating props.
H5P equivalents
LessonKit |
H5P |
|---|---|
|
Multiple Choice |
|
True/False |
|
Fill in the Blanks |
|
Drag and Drop |
|
Drag the Words |
|
Mark the Words |
|
Question Set |
|
Course Presentation |
|
Interactive Video |
|
Interactive Book / Column |
|
Self-hosted video (slides/pages) |
|
Summary |
|
Image Pairing |
|
Image Sequencing |
|
Memory Game |
|
Questionnaire |
|
Essay |
|
Arithmetic Quiz |
|
Information Wall |
|
Slideshow (parallax) |
|
Branching Scenario |
|
Iframe Embedder |
|
Chart (bar / list pie + table) |
|
Table |
|
Timeline |
|
Crossword |
|
Word Search |
|
Combination Lock |
|
Game Map |
|
Image Juxtaposition |
|
Image Sequence |
|
Collage |
|
Audio Recorder |
|
QR Content |
|
Advent Calendar |
|
Sort the Paragraphs |
|
Guess the Answer |
|
Multimedia Choice |
|
Single Choice Set |
|
Scenario / narrative block |
|
Open response (manual scoring) |
Compound containers include InteractiveBook, SlideDeck, InteractiveVideo, BranchingScenario (1.5), and GameMap (1.6). See Coming from H5P? and the capability map.
Framework 1.6 blocks (Table, Timeline, Crossword, WordSearch, GameMap, CombinationLock, and others): see Block catalog — 1.6.0 and generated prop tables.
Framework 1.7 blocks (SortParagraphs, GuessTheAnswer, MultimediaChoice, SingleChoiceSet, plus Quiz multi-select/shuffle/feedback): see Block catalog — 1.7.0 and Migration 1.6 → 1.7.
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 in running text |
|
|
Question-set container; aggregates child handles |
|
|
Course Presentation; keyboard slide nav; |
|
|
Single slide row inside |
|
|
Interactive Video; pause on cue; |
|
|
Single timed overlay child inside |
|
|
Self-hosted video primitive |
|
|
Statement-bank construct task |
|
|
Multi-chapter book; |
|
|
Graph navigation; |
|
|
Sandboxed iframe |
|
|
Bar chart or list-style pie + data table |
|
|
Column/chapter inside |
|
optional |
Textarea reflection block |
|
optional |
Shows completed lesson count |
Content and presentation blocks¶
These blocks ship in @lessonkit/react and appear in the block catalog. Props below are summaries — see generated prop tables for full contracts.
Component |
Required props |
Role |
|---|---|---|
|
|
Rich text paragraph |
|
|
Semantic heading ( |
|
|
Accessible image |
|
|
Match image pairs assessment |
|
|
Order images correctly |
|
|
Numeric drill assessment |
|
|
Long-form text (manual scoring) |
|
|
Multi-field form |
|
|
Card-matching game |
|
|
Searchable panel grid |
|
|
Parallax image slideshow |
|
|
Expandable sections |
|
|
Flip/dialog cards |
|
|
Study deck |
|
|
Clickable image regions |
|
|
Before/after or image carousel |
|
|
Single hotspot find task |
|
|
Multiple hotspot find task |
|
|
Accessible data table (1.6) |
|
|
Event list with focus tracking (1.6) |
|
|
Grid fill assessment (1.6) |
|
|
Letter grid word find (1.6) |
|
|
Digit entry assessment (1.6) |
|
|
Spatial compound map (1.6) |
|
|
Before/after slider (1.6) |
|
|
Stepped image frames (1.6) |
|
|
Multi-image layout (1.6) |
|
|
Browser audio capture (1.6) |
|
|
QR payload with reveal (1.6) |
|
|
Door-based reveal calendar (1.6) |
Import tree-shake friendly: import { Quiz } from "@lessonkit/react/blocks".
Course accepts config for tracking/xAPI and optional sinks (same shape as LessonkitProvider).
Common optional props¶
Full contracts: Block catalog · Storybook gallery · Storybook on GitHub Pages.
Component |
Optional props |
Notes |
|---|---|---|
|
|
|
|
|
Completes on unmount when another lesson becomes active |
|
|
|
|
|
Enables block-level URNs on manual |
|
|
Compound resume via |
|
|
Same compound resume rules as |
|
|
Graph resume; pre-1.5 sessions restart at |
|
|
Restrictive iframe defaults; opt in extra |
|
|
Accessible data table fallback for screen readers |
|
|
|
LessonkitConfig (on Course / LessonkitProvider)¶
Field |
Purpose |
|---|---|
|
Sink, batch sink, |
|
Transport, client, |
|
|
|
Production monitoring hooks (required when delivery enabled) |
|
|
|
Telemetry/lifecycle plugin registry |
Errors: assertProductionCourseConfig() throws in production when console sinks, missing delivery, or missing observability hooks. See production checklist.
Storybook¶
Browse published stories: Storybook on GitHub Pages · Component gallery (Storybook) on Read the Docs.
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 + |
|
|
|
Active node, visited path, |
|
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.