Quiz¶
H5P equivalent
H5P Multiple Choice — one question with several options and a single correct answer.
KnowledgeCheck is a deprecated alias of Quiz — import Quiz in new code. See the KnowledgeCheck page if you maintain legacy imports.
When to use¶
Use Quiz when learners must pick one correct option from a short list. Ideal for procedure checks, tool selection, and “best first step” scenarios.
Prefer something else when:
The answer is only true or false — use
TrueFalse.Learners construct an answer from blanks or draggable words — use fill-in or drag blocks.
Requirements¶
Must be inside an active
Lessonfor quiz telemetry (lessonIdon events).choicesandanswermust match exactly (string equality).Optional
passingScorefor packaging (defaults apply per manifest).
Try it¶
Documentation demo
Use the Live demo, React, AI prompt, and Packaging / Manifest tabs below. Embedded demos disable telemetry, xAPI, and the LMS bridge. For production delivery, use the CLI template src/courseConfig.ts and LMS Go-Live.
<Quiz
checkId="verify-quiz"
question="What should you verify before clicking a password-reset link?"
choices={[
"The sender domain and link destination",
"The email font and signature image",
"How urgent the subject line sounds",
]}
answer="The sender domain and link destination"
/>
Copy into Cursor, Copilot, or ChatGPT after the vibe coding starter context:
Read lessonkit.json and src/App.tsx before editing.
Add a Quiz block (H5P-style: Multiple Choice) like this example inside the active <Lesson>:
<Quiz
checkId="verify-quiz"
question="What should you verify before clicking a password-reset link?"
choices={[
"The sender domain and link destination",
"The email font and signature image",
"How urgent the subject line sounds",
]}
answer="The sender domain and link destination"
/>
Requirements:
- Import only from @lessonkit/react; use block types from block-catalog.v3.json.
- Keep existing courseId, lessonId, and navigation stable unless I ask to add a lesson.
Sync lessonkit.json — add under course.assessments[]:
{
"checkId": "verify-quiz",
"kind": "mcq",
"question": "What should you verify before clicking a password-reset link?",
"choices": ["The sender domain and link destination", "The email font and signature image", "How urgent the subject line sounds"],
"answer": "The sender domain and link destination"
}
- After edits, list changed files and what to verify in the browser (lessonkit dev).
Workflow tips: https://lessonkit.readthedocs.io/en/latest/guides/vibe-coding/prompting-and-workflows.html
Omit kind or set "kind": "mcq". Choices and answer must match React props exactly.
{
"checkId": "verify-quiz",
"kind": "mcq",
"question": "What should you verify before clicking a password-reset link?",
"choices": ["The sender domain and link destination", "The email font and signature image", "How urgent the subject line sounds"],
"answer": "The sender domain and link destination"
}
Multi-select (1.7.0)¶
When answers contains more than one correct label, Quiz switches to checkbox mode. Learners must click Check before the answer is scored. maxScore equals answers.length; partial credit counts correct selections, but any wrong choice fails the attempt.
<Quiz
checkId="hazards-multi"
question="Select all workplace hazards"
choices={["Phishing email", "Service portal", "Tailgating"]}
answer="Phishing email"
answers={["Phishing email", "Tailgating"]}
/>
In lessonkit.json, add answers alongside answer (required for backward compatibility):
{
"checkId": "hazards-multi",
"kind": "mcq",
"question": "Select all workplace hazards",
"choices": ["Phishing email", "Service portal", "Tailgating"],
"answer": "Phishing email",
"answers": ["Phishing email", "Tailgating"]
}
Inside compounds (AssessmentSequence, SingleChoiceSet), Next stays disabled until Check is pressed in multi-select mode.
With LXPack 0.7.0+, multi-select MCQ descriptors inject into LMS shell quizzes. Include answers (length > 1) in lessonkit.json assessments[] when you want native checkbox scoring in SCORM/xAPI/cmi5 exports.
Choice shuffle and feedback (1.7.0)¶
Prop |
Behavior |
Packaging |
|---|---|---|
|
Randomize option order |
Injectable into LMS shell (0.7.0+) |
|
Stable order across resume in SPA (defaults to |
SPA-only |
|
Map of choice label → feedback string; announced via |
SPA-only text; shell gets |
Omit these props for identical behavior to 1.6.x single-select quizzes.