Calm motion: animations on this site only fade, with no movement
Quiz
Questions with choices, a check after each answer, and a score
Tests what a learner knows, one question at a time. After each answer, the quiz shows the right choice and why. For a survey with no right answers, use the questionnaire.
Basic
questionsis a list of questions. Each question has aquestion, a list ofchoices, the index of the right choice inanswer, and an optionalexplain.- The learner picks a choice and presses "Check". The right choice gets a check mark and a solid edge. A wrong pick gets a cross and a dashed edge. The choices then lock.
- A status line says "Right!" or gives the right answer, with the reason. Screen readers hear it.
- After the last question, the quiz shows the score and emits
finishwith the right answers and the total. "Start again" goes back to the first question. - The choices of each question are native radio buttons in a group, and the focus moves to each new question. Change the words with
labelsor a label pack:check,next,finish,restart,right, and the functionswrong,progress, andscore.
Usage
ts
import { BlessQuiz } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
questions* | BlessQuizQuestion[] | — | |
labels | Partial<{ check: string; next: string; finish: string; restart: string; right: string; wrong: (answer: string) => string; progress: (n: number, total: number) => string; score: (right: number, total: number) => string; }> | — |
Events
| Name | Payload | Description |
|---|---|---|
finish | [right: number, total: number] |