Question Types
Every question in a survey has a type that determines how it's rendered and what kind of data it collects. The library ships with 17 built-in types and supports custom types via the extensible type system.
Text
Single-line text input for short answers.
type: "text"Textarea
Multi-line text input for longer responses.
type: "textarea"Number
Numeric input with min/max validation support.
type: "number"Email input with built-in email format validation.
type: "email"Radio
Single-choice selection from a list of options.
type: "radio"Checkbox
Multi-choice selection from a list of options.
type: "checkbox"Select
Dropdown menu for single-choice selection.
type: "select"Date
Date picker input for date values.
type: "date"Time
Time picker input with optional 12h/24h format and min/max constraints.
type: "time"Date & Time
Combined date and time picker with min/max datetime constraints.
type: "datetime"Slider
Range slider with configurable min, max, step, unit, and labels.
type: "slider"Phone
Phone number input with country code prefix and built-in validation.
type: "phone"Rating
Star rating with configurable count (2β10 stars).
type: "rating"URL
Website/link input using the native URL input type with built-in URL format validation.
type: "url"Password
Masked text input with an optional show/hide toggle button for password or secret values.
type: "password"Boolean
Yes/No toggle with fixed options. Only label text is customizable.
type: "boolean"File Upload
Drag-and-drop or click-to-browse file input with configurable accept types, max files, and size limits.
type: "file"Common Question Properties
All question types share these base properties. Each type may support additional type-specific options documented on its own page.
{
id: string; // Unique identifier
type: QuestionType; // One of the built-in types or a custom string
label: string; // Display label
description?: string; // Optional helper text
placeholder?: string; // Input placeholder text
required?: boolean; // Whether the field is required
defaultValue?: any; // Default answer value
validation?: []; // Array of validation rules
visibleIf?: string; // Conditional visibility expression
meta?: {}; // Arbitrary metadata for custom types
}Custom Question Types
Beyond the 17 built-in types, you can register any string as a question type and provide a custom React component to render it. The type system uses string & {} to allow arbitrary types while preserving autocomplete for built-in ones.
// Register a custom component for your type
<SurveyRenderer
schema={schema}
components={{
"file-upload": MyFileUploadComponent,
"color-picker": MyColorPickerComponent,
}}
/>