PracticeQuestion
Generated from front/ui/catalogue/examples/PracticeQuestion.json
learning · interactive (ships a small web component) · no children. All components: component playground.
Description for the model
Section titled “Description for the model”One multiple-choice practice question with exactly one right option. The learner picks an option and presses Check; the result is stated in words and the explanation appears only after that first attempt. Nothing is recorded or sent. Used in extra help; the plain-text fallback leaves out the answer.
Live example
Section titled “Live example”Rendered from the example props below with the real component. Theme: coffee · oncall · nightsky · gravity · poland · ulam · platform · open on its own
Example
Section titled “Example”{ "component": "PracticeQuestion", "props": { "title": "Try it yourself", "markdown": "Use the ratio from the worked example.", "practice": { "stem": "How much coffee do you need for 480 ml of water at a 1:16 ratio?", "options": [ { "text": "20 g", "correct": false }, { "text": "30 g", "correct": true }, { "text": "48 g", "correct": false } ], "explanation": "480 divided by 16 is 30, so 30 g of coffee." } }}| Prop | Type | Required | Notes |
|---|---|---|---|
title |
string | yes | Heading of the block. max length 120 |
markdown |
string | yes | Markdown, at most 1 800 characters; raw HTML is escaped. max length 1800 |
practice |
object | yes | |
practice.stem |
string | yes | The question. max length 400 |
practice.options |
array of objects | yes | 2 to 5 answer options; exactly one is correct. min 2 items, max 5 items |
practice.options[].text |
string | yes | Answer option. max length 200 |
practice.options[].correct |
boolean | yes | Whether this option is right. default false |
practice.explanation |
string | yes | Why the right option is right; shown only after the learner checks an answer. max length 400 |
locale |
"en" | "pl" | "zh" |
Interface language of the fixed strings; filled by the app, authors and models leave it out | |
id |
string | Anchor id for in-page links (letters, digits, dashes). max length 40 |
Text fallback
Section titled “Text fallback”What a text-only client, an unknown renderer or a plain-text channel shows for the example above.
Try it yourselfUse the ratio from the worked example.How much coffee do you need for 480 ml of water at a 1:16 ratio?- 20 g- 30 g- 48 gInvalid props
Section titled “Invalid props”A node whose props fail the schema never breaks the page: the renderer shows the plain-text fallback instead (and logs the issues in development).
{ "title": "One option only", "markdown": "Too few options.", "practice": { "stem": "Which one?", "options": [ { "text": "Only", "correct": true } ], "explanation": "There must be at least two options." }}Issues:
/practice/optionsfewer than 2 items
Rendered as:
One option onlyToo few options.Which one?- OnlyAccessibility
Section titled “Accessibility”axe-core: 20 rules passed, 0 violations, 1 need manual review. Run at build time on the server-rendered HTML in jsdom. Colour contrast and layout rules need a browser and are covered by the Playwright axe scans of the reference frontend.