Changelog
All notable changes to react-minimal-survey-builder will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[0.4.1] — 2026-03-02
✨ Added
filequestion type — new 17th built-in type providing a drag-and-drop file upload zone. Supports a click-to-browse fallback, multi-file selection, and all the features below:accept— comma-separated MIME types or file extensions passed to the native<input accept>attribute (e.g.".pdf,image/*"). Enforced client-side in code — files that do not match are rejected with an inline error, even when dropped via drag-and-drop.maxFiles— maximum number of files (default1). Values > 1 enable multi-file mode; the drop zone hides once the cap is reached.maxFileSize— per-file size limit in bytes. Oversized files are rejected with a human-readable error message (B / KB / MB).maxTotalSize— combined size cap across all selected files in bytes.- All four constraints are enforced both in real-time in the renderer (shown as inline errors immediately on file selection or drop) and by the validation engine on next-page / submit.
FileAnswerinterface — exported from the main entry point. Shape:{ name: string; size: number; type: string; lastModified: number; file: File }. Thefileproperty is the raw browserFileobject for use inFormDataupload calls.matchesAccepthelper (internal) — validates a file againstaccepttokens supporting three formats: extension (.pdf), MIME wildcard (image/*), and exact MIME (application/pdf). Rejects all three drag-drop / keyboard / paste paths, not just the file-picker UI.- Real-time inline file validation —
DefaultFileInputnow shows constraint violations immediately, without waiting for form submission:- Wrong file type → error naming each rejected file and the allowed types.
- Per-file size exceeded → error naming oversized files and the limit.
- Total size exceeded → error showing the combined size vs. the cap.
- Max files exceeded → message showing how many could not be added.
- Drop zone border turns red on any active error.
- File config panel in the builder —
QuestionEditornow includes aFile Uploadsettings section with inputs for accepted types, max files (slider, 1–20), max file size (MB), and max total size (MB). FileAnswer[]inAnswerValue— theAnswerValueunion now includesFileAnswer[].- Website documentation for
filetype — new/docs/types/filepage covering all props, theFileAnswerinterface, built-in vs. custom validation,onSubmitFormData walkthrough, cross-questionvalidatorsexample, and a session-only tip. Also updated: types overview grid, API types reference (Question,QuestionType,AnswerValue, newFileAnswersection), all-types example per-type table, navigation sidebar, and search index. questionNumberonQuestionComponentProps— the optionalquestionNumberprop is now included in theQuestionComponentPropstype and is passed to all custom components registered via thecomponentsprop, enabling custom components to render consistent question numbering without having to compute it themselves.
🚀 Improved
- Custom component full rendering autonomy — components registered via the
componentsprop now take complete control of their output. Previously, theQuestionRendererwould always inject a label, description paragraph, and error message around every custom component. Now, when a custom component is detected, the wrapper is bypassed entirely and the component is responsible for its own label, description, and error display. Built-in components continue to receive the automatic label/description/error wrapper. questionNumberforwarded to built-in components — built-in question renderers now also receivequestionNumberso custom and built-in rendering paths are consistent.
🔄 Changed
- Custom
validatorfunction signature changed to 3 parameters (breaking for custom validators) — was(value: AnswerValue, answers: SurveyAnswers), now(value: AnswerValue, question: Question, answers: SurveyAnswers). Thequestionparameter (second) gives access to the full question definition inside a validator. Update any existing validators by adding the question param:
Affected types:// before validator: (value, answers) => value === answers["password"] ? null : "No match"; // after validator: (value, _question, answers) => value === answers["password"] ? null : "No match";ValidationRule.validator,SurveyOptions.validators,SurveyPlugin.validators. BuiltInQuestionTypeunion now includes"file"— 17 built-in types total (up from 16).Questioninterface extended withaccept?: string,maxFiles?: number,maxFileSize?: number,maxTotalSize?: number.- Types overview page description updated from 16 to 17 built-in types.
- All-types example per-type answer table updated with
file → FileAnswer[]row. - API types page updated:
BuiltInQuestionType,Question,AnswerValue, import list, and newFileAnswersection. QuestionComponentPropsinterface extended withquestionNumber?: number.- Internal component declarations in
QuestionRenderer,SurveyRenderer,SurveyBuilder, andQuestionEditormigrated fromReact.FC<Props>to inline destructured-parameter type annotations — no runtime impact, improves TypeScript inference instrictmode.
🐛 Fixed
acceptenforcement was previously only cosmetic (browser file-picker filter). Files dropped via drag-and-drop or selected by bypassing the picker were silently accepted regardless of their type. Now any file that does not match theaccepttoken list is rejected before being added to the answer, with a descriptive error.- Removed-file re-validation: deleting a file from the list now re-validates all remaining files for per-file size and total size constraints and clears the error if all remaining files are compliant.
[0.4.0] — 2026-02-23
✨ Added
- URL question type — new
urlbuilt-in type using the browser's nativetype="url"input. Brings up the correct keyboard on mobile and supports the newurlvalidation rule. Default placeholder is"https://example.com". Answer value is astring. - Password question type — new
passwordbuilt-in type with a masked input and an optional show/hide toggle button. Controlled by the newpasswordShowToggleproperty (defaults totrue; set tofalseto always keep input masked). Answer value is astring. - URL validation rule — new
urlrule type that validates the value withnew URL()and requires the protocol to behttp:orhttps:. controlTypefor boolean questions — newcontrolTypeproperty ("radio"|"switch"|"checkbox") controls how a boolean question is rendered."radio"(default) shows two radio buttons,"switch"renders an accessible toggle with false/true labels on each side, and"checkbox"renders a single checkbox where the questionlabeldoubles as the inline checkbox text.hideLabelquestion property — newhideLabel: booleanon theQuestioninterface suppresses the label element (useful whencontrolType: "checkbox"already shows the label inline).- Boolean
requiredenforcement for checkboxes — when abooleanquestion usescontrolType: "checkbox"andrequired: true, validation now enforcesvalue === true(the box must be checked). Useful for ToS agreements and consent flows. - Documentation pages — new full reference pages for
url(/docs/types/url) andpassword(/docs/types/password) with options tables, validation examples, and practical code examples. - Per-type playground schemas — added dedicated playground example schemas for all 16 built-in question types (
type-text,type-textarea,type-number,type-email,type-radio,type-checkbox,type-select,type-date,type-time,type-datetime,type-slider,type-phone,type-url,type-password,type-rating,type-boolean). - Customisable playground button label —
OpenInPlaygroundButtonnow accepts an optionaltextprop to override the default "Open in Playground" label.
🔄 Changed
booleananswer value is now a nativeboolean(breaking change) — previously returned the strings"yes"/"no". Now returnstrue/false. Update anyvisibleIfexpressions that referred to=== 'yes'/=== 'no'to use=== true/=== false.BuiltInQuestionTypeunion now includes"url"and"password"(16 built-in types total, up from 14).ValidationRuleTypeunion now includes"url".Questioninterface extended withpasswordShowToggle,controlType, andhideLabelproperties.QuestionRenderercomponent: thehideLabelprop has been removed from the component's props; usequestion.hideLabelin the schema instead.- Types overview page updated to list all 16 built-in types with new grid cards for URL and Password.
- Boolean type documentation page rewritten to cover all three
controlTypevariants, the new boolean answer value, andrequiredcheckbox enforcement. - Validation documentation page fully rewritten to cover all 11 built-in rule types (
required,minLength,maxLength,pattern,min,max,email,url,phone,time,custom) with per-rule code examples, default error messages, and an "Applies to" column in the overview table. - Navigation sidebar and search index updated with entries for URL and Password type pages.
- Conditional logic documentation examples updated from
=== 'yes'to=== truefor boolean comparisons. - Schema documentation page: boolean question answer type corrected from
stringtoboolean. - FAQ and landing page bundle size figures updated to reflect the current
~13 KBgzipped size (was~11 KB). - Demo page default schema now generates question IDs with
uid()instead of hard-codedq1…q6. banner.svgremoved from the repository and from the npm publish file list.
🐛 Fixed
- Boolean radio and switch components: option
onChangenow correctly emitstrue/falsevalues instead of the string literals"yes"/"no". QuestionEditor(builder):urlandpasswordquestion types were missing from the type dropdown.
[0.3.0] — 2026-02-18
✨ Added
- Time question type — new
timebuilt-in type using the browser's native time picker. SupportsminTime/maxTimeconstraints andtimeFormatpreference ("12h"/"24h"). Answer value is a string inHH:MMformat. - Datetime question type — new
datetimebuilt-in type using a nativedatetime-localinput for combined date and time selection. SupportsminDatetime/maxDatetimeconstraints. Answer value is a string inYYYY-MM-DDTHH:MMformat. - Slider question type — new
sliderbuilt-in type rendering a range slider with configurablesliderMin,sliderMax,sliderStep, optionalunitsuffix,showValuetoggle, andminLabel/maxLabelscale labels. Answer value is anumber. - Phone question type — new
phonebuilt-in type using a nativetelinput with an optionalcountryCodeprefix badge. Answer value is astring. - Phone validation rule — new
phonevalidation rule type that validates phone numbers against a flexible pattern (7–20 digits with optional+, spaces, dashes, and parentheses). - Time validation rule — new
timevalidation rule type that validates time strings againstHH:MM/HH:MM:SS24-hour format. - Builder support — all 4 new types added to the question type dropdown in
QuestionEditorwith type-specific settings panels (slider min/max/step/unit/showValue, phone country code, time format/min/max, datetime min/max). - Documentation pages — full reference pages for each new type at
/docs/types/time,/docs/types/datetime,/docs/types/slider, and/docs/types/phonewith options tables, validation examples, and practical code examples.
🔄 Changed
BuiltInQuestionTypeunion now includes"time","datetime","slider", and"phone"(14 built-in types total).ValidationRuleTypeunion now includes"phone"and"time".Questioninterface extended withsliderMin,sliderMax,sliderStep,showValue,unit,countryCode,timeFormat,minTime,maxTime,minDatetime, andmaxDatetimeproperties.- Types overview page updated to show 14 built-in types with new grid cards.
- Schema documentation page updated with new types in the Question interface and type reference table.
- All-types example and playground schema updated with a new "Contact & Scheduling" page showcasing all 4 new types.
- Navigation sidebar updated with links to the 4 new type documentation pages.
[0.2.0] — 2026-02-18
✨ Added
- Boolean question type — new
booleanbuilt-in type rendering a Yes/No radio group with customizable labels viaoptions. Answer value is"yes"or"no". - Rating display modes — new
displayModeproperty on rating questions:"stars"(default, existing star UI) or"buttons"(numbered 1–N button scale with exact-match selection). - Rating scale labels — new
minLabelandmaxLabelproperties for rating questions to display descriptive text at the low and high ends of the scale (e.g. "Not at all likely" / "Extremely likely"). Works with both display modes. - Rating builder controls — display mode toggle, dynamic count label ("Number of Stars" / "Number of Buttons"), and min/max label inputs in both the
QuestionEditorcomponent and the demoSettingsPanel.
🚀 Improved
- Question-based progress bar — progress calculation changed from page-based to question-based (answered visible questions / total visible questions) in the playground and demo, matching the
useSurveyhook behavior. - Playground validation — added full validation support to the playground
PreviewRendererincluding required, minLength, maxLength, min, max, email, and pattern rules with inline error display and validation on Next/Submit. - visibleIf regex — fixed condition expression parsing from
\{(\w+)\}to\{([^}]+)\}to support hyphenated question IDs invisibleIfexpressions.
🔄 Changed
BuiltInQuestionTypeunion now includes"boolean"(10 built-in types total).Questioninterface extended withdisplayMode,minLabel, andmaxLabelproperties.- Rating documentation page updated with new properties table, display mode examples, and scale label examples.
[0.1.0] — 2026-02-17
✨ Added
- Headless survey engine — a fully headless, JSON-schema driven survey hook for React with zero heavy dependencies.
- 9 built-in question types — text, textarea, number, email, radio group, checkbox group, select dropdown, date picker, and star rating.
- Configurable star rating — adjustable star count (2–10) with a visual slider in the builder and live preview.
- Multi-page surveys — organize questions across multiple pages with independent titles and descriptions.
- Page navigation — next, previous, and direct go-to-page controls with configurable back-navigation.
- Progress tracking — automatic percentage-based progress calculated from answered visible questions, with an optional progress bar.
- Conditional visibility — show or hide questions and entire pages based on dynamic expressions referencing other answers, supporting comparison, logical, and containment operators.
- Validation engine — 8 built-in validation rules (required, min/max length, pattern, min/max value, email, custom) with per-rule custom error messages.
- Custom validators — support for user-defined validation functions that receive the current answer and all survey answers.
- Drag-and-drop survey builder — visual builder component with HTML5 native drag & drop for reordering questions within and across pages, with no external dependencies.
- Drop indicator — visual placeholder line showing the exact drop position while dragging questions or palette items.
- Page management in builder — add, remove, rename, and reorder pages directly from the builder UI.
- Question editor panel — inline property editor for label, type, required toggle, placeholder, description, options, visibility conditions, default values, and advanced settings.
- Live preview — real-time survey preview alongside the builder, rendered with the actual survey renderer.
- JSON editor — raw JSON editing tab for direct schema manipulation with live parsing.
- Builder layout options — horizontal (side-by-side) and vertical layout modes.
- Controlled builder component — standard
value/onChangepattern for external schema management. - Custom question types — extensible type system allowing arbitrary custom question types with full autocomplete support for built-in types.
- Custom component overrides — override any built-in question renderer or register components for entirely new question types.
- Plugin system — plugin architecture supporting custom renderers, validators, and event middleware.
- Render props — full layout control via render-prop children, custom header, footer, and completion screen renderers.
- Survey settings — configurable progress bar visibility, question numbering, navigation button text, and page-change validation behavior.
- Default values — per-question default answers merged with optional initial answer data.
- Async submit handling — built-in submit flow with success/error handling and inline error display.
- Reset support — full survey state reset to initial values.
- Completion screen — default thank-you screen after submission, fully customizable.
- Framework-agnostic core — standalone core module (
/core) for schema parsing, validation, condition evaluation, and state management without React. - Event system — subscribe to answer changes, page changes, validation, submission, and visibility change events with cleanup support.
- Accessibility — ARIA attributes on inputs, error messages, radio/checkbox groups, rating buttons, and required indicators; semantic HTML labels throughout.
- Full TypeScript support — TypeScript-first codebase with 24+ exported types and interfaces, generic component props, and strict typing.
- Three entry points — main package,
/core(framework-agnostic), and/builder(visual builder only), all supporting CJS, ESM, and TypeScript. - Tree-shakable — marked
sideEffects: falsefor optimal bundling. - Lightweight — ~11kb gzipped total bundle size.
- SSR compatible — no browser-only APIs; safe for server-side rendering.
- Schema validation — descriptive error messages for malformed survey schemas.
- Performance optimized — memoized components and schema parsing for minimal re-renders.
Template for future releases:
[x.y.z] — YYYY-MM-DD
✨ Added
- New features.
🚀 Improved
- Performance or UX enhancements.
🐛 Fixed
- Bug fixes.
🔄 Changed
- Behavioral or API changes (non-breaking).
❌ Removed
- Removed features or deprecated APIs.
🔒 Security
- Security-related patches.
⚠ Breaking Changes
- Changes requiring consumer action to upgrade.