terra vidhal

Quiz Builder

Component

About

A quiz builder with typed questions, editable choices and correct-answer markers, validation, reordering, duplication, delete with undo, a question type distribution bar and an interactive preview with score summary, answer checking and explanations.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Quiz Builder to your project and fits it to your theme.

Code

How Quiz Builder is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

/**
 * PrequelUI Animate — MIT — https://prequeluianimate.terravidhal.me
 */

import { QuizBuilder, type QuizQuestion } from "@/components/ui/quiz-builder";

const QUESTIONS: QuizQuestion[] = [
  {
    id: "q1",
    type: "single",
    prompt: "Which practice keeps a shared calendar readable?",
    points: 1,
    options: [
      { id: "q1a", text: "Use clear titles and consistent time blocks", correct: true },
      { id: "q1b", text: "Double-book every focus block", correct: false },
      { id: "q1c", text: "Leave the location field empty", correct: false },
    ],
    explanation: "Clear titles and consistent blocks make the week easy to scan.",
  },
  {
    id: "q2",
    type: "multiple",
    prompt: "Select every sign that a meeting could be an async update.",
    points: 2,
    options: [
      { id: "q2a", text: "It is a one-way status report", correct: true },
      { id: "q2b", text: "It needs a live decision from three people", correct: false },
      { id: "q2c", text: "It repeats information already written down", correct: true },
      { id: "q2d", text: "It is a celebration with the whole team", correct: false },
    ],
    explanation: "One-way updates and repeated information work well in writing.",
  },
  {
    id: "q3",
    type: "truefalse",
    prompt: "A weekly digest should include every small change from the week.",
    points: 1,
    options: [
      { id: "q3a", text: "True", correct: false },
      { id: "q3b", text: "False", correct: true },
    ],
    explanation: "A digest should surface what changes decisions, not every detail.",
  },
  {
    id: "q4",
    type: "single",
    prompt: "What belongs in the first line of a project update?",
    points: 1,
    options: [
      { id: "q4a", text: "The decision or change the reader needs", correct: true },
      { id: "q4b", text: "A long list of every task completed", correct: false },
      { id: "q4c", text: "The next meeting agenda", correct: false },
    ],
    explanation: "Lead with the change so readers can act on it quickly.",
  },
];

export default function QuizBuilderDemo() {
  return (
    <main className="flex min-h-screen w-full items-start justify-center bg-gradient-to-b from-muted/40 via-background to-background px-4 py-8 sm:px-6">
      <QuizBuilder
        questions={QUESTIONS}
        title="Build the team quiz"
        quizTitle="Calmer collaboration basics"
      />
    </main>
  );
}

Dependencies

More by terra vidhal

View all
  • Project Timeline

    Project Timeline

    30
  • Kanban Board

    Kanban Board

    20
  • Gravity Stars Background

    Gravity Stars Background

    20
  • Booking Calendar

    Booking Calendar

    18
  • Notification Center

    Notification Center

    16
  • Audio Waveform

    Audio Waveform

    16
  • Kpi Counter

    Kpi Counter

    16
  • Topographic Lines

    Topographic Lines

    16

Explore more

Part of PrequelUI Animate — browse the full library on 21st.dev.