Componentdata0.73 KB gzipZero dependencies
Quiz Card
Mini quiz card with options and correct/incorrect feedback.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add quiz-cardOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { QuizCard } from "@/components/ui/quiz-card"; <QuizCard />Source code
quiz-card.tsx + 1 helperZero 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 />| Prop | Type | Description |
|---|---|---|
| question | string | Configures question. (Default: "") |
| options | QuizOption[] | Selectable options list. (Default: []) |
| onAnswer | (optionId: string, correct: boolean) => void | Callback invoked on answer. |