React Quiz Builder — Build Quizzes as React Components
quiz-ui is a React quiz builder that treats a quiz as data, not UI. You define a QuizDefinition object (id, entry step, array of step definitions) and wrap it in QuizRoot. The engine — a useReducer-based state machine — handles answer collection, branching resolution, and progress calculation. Your job is styling the questions.
Last updated: 2026-09-25
Frequently asked questions
How does the React state management work?
QuizProvider (used by QuizRoot) owns a useReducer initialized from your QuizDefinition. All components read/write via the useQuizAnswers and useQuizStep hooks.
Can I use Redux or Zustand instead?
The engine is self-contained. If you want external state, call onComplete with the answers and feed them into your store.
Does it support React Server Components?
The quiz components are client components ('use client'). You can render QuizRoot inside a client boundary within an RSC page.