quiz-ui
Radix-based components for building quiz funnels, distributed shadcn-style.
Visit the · Built on
Contributing
Please read the .
Usage Example
To add the quiz-choice component to your project, run the following command:
(First time using a quiz-ui component in this project? Add the registry
to your components.json — see .)
Once installed, you can import and use the component in your files:
Note: The import path @/components/ui/quiz assumes your project
has a path alias configured (see components.json's aliases.ui).
Adjust the path to match your project's structure if needed.
See app/example/ in this repo for a complete branching funnel.
Repo structure
Local development
Design notes
- Two layers.
components/ui/quiz/coreis headless (state machine + hooks, no styling); the rest ofcomponents/ui/quiz/is styled and built on Radix + the core hooks. Restyling never touches branching logic; extending branching logic never touches component code. - Branching is data, not code. A
QuizDefinitionis a plain, serializable object. Answer components never receivevalue/onChangeprops — they read/write the current step's answer viauseQuizAnswers()automatically. - Distribution mirrors shadcn.
registry.jsonconforms to shadcn's native registry schema, built with shadcn's ownshadcn buildCLI command rather than a bespoke script — seecontributing.md.
License
MIT