quiz-ui
Components

QuizDialog

Modal-embedded funnel wrapper, built on Radix Dialog.

Purpose

For funnels launched from a button rather than embedded inline on the page — wraps your funnel in a Radix Dialog, handling focus trapping and Escape-to-close automatically.

Installation

pnpm dlx shadcn@latest add @quiz-ui/quiz-dialog

Usage

<QuizDialog trigger={<button>Take the quiz</button>}>
  <QuizRoot definition={quiz}>
    <QuizProgress />
    <QuizStep>{/* ... */}</QuizStep>
    <QuizNavigation />
  </QuizRoot>
</QuizDialog>

Props

PropTypeDefaultDescription
triggerReact.ReactNodeElement that opens the dialog. Omit to control open state externally via open/onOpenChange.
childrenReact.ReactNodeYour funnel — typically a QuizRoot and its contents.
classNamestringMerged onto the dialog content panel.
...restReact.ComponentPropsWithoutRef<typeof Dialog.Root>e.g. open, onOpenChange, defaultOpen.

Notes

  • QuizDialog only depends on quiz-cn, not quiz-core — it's a plain layout wrapper and doesn't touch the engine itself. The QuizRoot you put inside it is what owns the engine, same as anywhere else.

On this page