GitHub

Assessment Form

Block
Interactive assessment/quiz form with question rendering and progress tracking

Installation

pnpm add @corew500/feature-assessment

Usage

import { AssessmentForm } from "@corew500/feature-assessment"

<AssessmentForm>Content</AssessmentForm>

API Reference

Props

PropTypeDefaultDescription
config*{ questions: { id: string; category: string; text: Record<string, string>; scale: { min: number; max: number; labels?: Record<string, string[]>; }; weight?: number; helpText?: Record<string, string>; }[]; ... 7 more ...; categoryLabels?: Record<...>; }—Assessment configuration
localestringenCurrent locale for question text
emailstring—User email (if known)
questionsPerPagenumber1Questions per page (default: 1)
onSubmit*(email: string, responses: { questionId: string; value: number; }[]) => Promise<{ success: true; result: { id: string; email: string; score: number; tier: "excellent" | "good" | "moderate" | ...—Callback when assessment is submitted
onComplete(result: { id: string; email: string; score: number; tier: "excellent" | "good" | "moderate" | ...—Callback when assessment is completed successfully
sourcestring—Additional metadata to include with submission
submitLabelstringSubmitCustom submit button text
nextLabelstringNextCustom next button text
previousLabelstringPreviousCustom previous button text
showProgressenumtrueShow progress bar
classNamestring—Additional class name for the form container
persistProgressenumfalsePersist progress to localStorage so users can resume
storageKeystring—Custom localStorage key (default: `assessment-progress-{config.id}`)
autoAdvanceenumfalseAuto-advance to next page after selection (true = 300ms, or pass custom ms)
showCategoryBadgesenumfalseShow category badge above each question
emailPositionenumfirstWhere to collect email: 'first' (page 0) or 'last' (after questions)
emailLabelstring—Custom email field label
emailPrivacyNotestring—Custom privacy note below email field
resumeLabels{ title?: string; message?: string; continueButton?: string; startFreshButton?: string; }—Labels for the resume progress modal
nextDisabledHintstringPlease select a rating to continueTooltip hint shown on the Next button when disabled (no selection made).
submitDisabledHintstringPlease answer all questions to continueTooltip hint shown on the Submit button when disabled.

Localization

Translatable Content

  • All text content should be pre-translated in the configuration. Pass the `locale` prop to select which language to display.