Quiz
Quiz
The Quiz component displays an interactive quiz with multiple-choice questions. It supports random question selection, immediate feedback, explanations, and score tracking. Perfect for educational content and knowledge testing.
Basic Usage
import Quiz from '@site/src/components/Quiz';
import quizData from '@site/src/data/quiz-demo.json';
<Quiz quizData={quizData} />
Live Preview:
Cardano Basics Quiz
Test your Cardano knowledge with this short quiz.
What is a "dapp"?
Props
| Prop | Type | Default | Description |
|---|---|---|---|
quizData | object | required | Quiz data object containing questions and metadata |
questionCount | number | 5 | Number of questions to randomly select from the quiz |
allowRetry | boolean | true | Whether users can retry an incorrect answer before moving to the next question |
passingScore | number | 60 | Minimum percentage required to pass (0-100) |
onRecord | function | null | (correct, total) => void, called once when the quiz finishes. Passing a function switches the component into hub mode, see Hub Mode below |
academyCta | object | null | {href, label, certifiedLabel, ariaLabel} shown as a follow-up link on the hub mode result screen. Build it with getAcademyCta(academyKey, quizId) from src/data/quiz/academy.js. label (with ariaLabel naming the destination) is used for a learning or bronze result, certifiedLabel for silver and gold. Ignored outside hub mode |