Quiz Components — Reusable Inputs for React
quiz-ui provides a set of quiz components that cover every common question type: single-select choice, multi-select checkbox, image choice grid, numeric slider, star/numeric rating, free text, and validated email. Each component reads and writes its answer automatically via React context — you never pass value/onChange props.
Last updated: 2026-09-25
Frequently asked questions
Why don't quiz-ui components use value/onChange props?
Because they read and write the current step's answer automatically via useQuizAnswers(). The engine owns the state; components just hook into it. This keeps QuizDefinition objects serializable and portable.
Can I create custom question components?
Yes. Use the useQuizAnswers hook from quiz-core to read/write the answer for the current step inside your own component.
Do I need to use all components?
No. Install only the ones you need via the shadcn CLI.