Runs a whole quiz: a progress bar, an optional timer per question, feedback after each answer or at the end, a score summary, a review and resume. Keys 1 to 9 pick, Enter checks and continues.
On this page
- A lesson check
- A certification quiz
- A timed practice set
- Onboarding questions with a score
Examples
Reveal at the end, with a timer
Save and resume
Installation
Installation is part of Pro
Pro components install from a licensed registry. The live preview stays open to everyone.
Props
- quizrequired
Quiz- { id, title, questions }. The same model the Quiz Builder edits (lib/knowns/quiz).
- feedback
"instant"|"end"- Default
"instant" - instant shows right and wrong after each question. end locks each answer and reveals everything on the summary.
- studentId
string- Default
"student" - Whose answers these are in the responses.
- onComplete
({ score, responses }) => void- Once, when the last answer is handed in. score has points, max, percent, correct and a grade per question; responses are QuizResponse objects.
- passPercent
number- Shows Passed or Not passed on the summary.
- partialCredit
boolean- Default
true - Multiple choice earns points for the right picks, less the wrong ones. false is all or nothing.
- defaultProgress / onProgress
QuizProgress- Plain data: { index, answers, locked, at, finished }. Save it from onProgress, hand it back to resume. Questions that no longer exist are dropped.
- storageKey
string- Save and resume in localStorage under this key; cleared when finished. It never throws when storage is off.
- summaryActions
ReactNode- Extra buttons on the summary, next to Review answers and Try again.
- Timer
timeLimitSec- A question with timeLimitSec counts down from its start (once a second), turns red in the last ten and locks the answer as it stands at 0. Resuming restarts the clock of the open question.
- Keyboard
keys- 1 to 9 pick, Enter checks, then focus lands on Next so Enter carries on; on the summary it lands on Review answers.
- Motion
180ms ease-out, score 280ms- Progress segments change colour, the verdict folds open and the score rolls up once. Nothing plays on first render or with reduced motion.
| Prop | Type | Default | Description |
|---|---|---|---|
| quizrequired | Quiz | required | { id, title, questions }. The same model the Quiz Builder edits (lib/knowns/quiz). |
| feedback | "instant" | "end" | "instant" | instant shows right and wrong after each question. end locks each answer and reveals everything on the summary. |
| studentId | string | "student" | Whose answers these are in the responses. |
| onComplete | ({ score, responses }) => void | - | Once, when the last answer is handed in. score has points, max, percent, correct and a grade per question; responses are QuizResponse objects. |
| passPercent | number | - | Shows Passed or Not passed on the summary. |
| partialCredit | boolean | true | Multiple choice earns points for the right picks, less the wrong ones. false is all or nothing. |
| defaultProgress / onProgress | QuizProgress | - | Plain data: { index, answers, locked, at, finished }. Save it from onProgress, hand it back to resume. Questions that no longer exist are dropped. |
| storageKey | string | - | Save and resume in localStorage under this key; cleared when finished. It never throws when storage is off. |
| summaryActions | ReactNode | - | Extra buttons on the summary, next to Review answers and Try again. |
| Timer | timeLimitSec | - | A question with timeLimitSec counts down from its start (once a second), turns red in the last ten and locks the answer as it stands at 0. Resuming restarts the clock of the open question. |
| Keyboard | keys | - | 1 to 9 pick, Enter checks, then focus lands on Next so Enter carries on; on the summary it lands on Review answers. |
| Motion | 180ms ease-out, score 280ms | - | Progress segments change colour, the verdict folds open and the score rolls up once. Nothing plays on first render or with reduced motion. |
What it handles
- 01Runs a quiz one question at a time with a segmented progress bar: right, wrong, answered, current and to do.
- 02Counts down a per-question timer when a question has a limit, and locks the answer as it stands when time runs out.
- 03Gives feedback after each question, or locks answers and reveals everything on the summary.
- 04Ends on a score summary with points, a result for each question and an optional pass mark, then a review of every answer.
- 05Saves progress as plain data (onProgress) or in localStorage (storageKey) and resumes where the person left off.
- 06Takes the whole quiz from the keyboard: keys 1 to 9 pick, Enter checks and continues, and focus lands on Next, then on Review.
States
- Answer handed in
- The progress segment turns right, wrong or answered
- 180ms, ease-out
- Verdict
- The explanation folds open under the question
- 180ms, ease-out
- Score
- The percentage rolls up to its value once
- 280ms, ease-out
- Timer
- Counts once a second; turns red in the last ten
- none
- First render
- Nothing plays
- none
- Reduced motion
- Everything lands at once
- 0ms
| State | What moves | Timing |
|---|---|---|
| Answer handed in | The progress segment turns right, wrong or answered | 180ms, ease-out |
| Verdict | The explanation folds open under the question | 180ms, ease-out |
| Score | The percentage rolls up to its value once | 280ms, ease-out |
| Timer | Counts once a second; turns red in the last ten | none |
| First render | Nothing plays | none |
| Reduced motion | Everything lands at once | 0ms |
Works with
When to use
When to use
- A lesson check or a certification quiz that runs from the first question to a score and a review.
- A timed practice set, or onboarding questions where progress should survive a reload.
When not to use
- One question inside your own layout: use Question Card.
- Writing or editing the questions: use Quiz Builder.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Quiz Player to my app and wire it to my own data.
- I need a lesson check or a certification quiz that runs from the first question to a score and a review. Set that up with the Knowns UI Quiz Player.
- Which Quiz Player props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "quiz-player" }) and search_docs({ query: "quiz player" }). Pro props, full examples and source come back once your license key is in the MCP config.