Componentdata0.73 KB gzipZero dependencies

Quiz Card

Mini quiz card with options and correct/incorrect feedback.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add quiz-card

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { QuizCard } from "@/components/ui/quiz-card"; <QuizCard />

Source code

quiz-card.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxquiz-card.tsx62 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface QuizOption {  id: string;  label: string;  correct?: boolean;} export interface QuizCardProps extends React.HTMLAttributes<HTMLDivElement> {  question: string;  options: QuizOption[];  onAnswer?: (optionId: string, correct: boolean) => void;} /** Quiz flashcard: answer options + correct/incorrect feedback. */

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { QuizCard } from "@/components/ui/quiz-card"; <QuizCard />
PropTypeDescription
questionstringConfigures question. (Default: "")
optionsQuizOption[]Selectable options list. (Default: [])
onAnswer(optionId: string, correct: boolean) => voidCallback invoked on answer.