Docs
v1.3.14
GitHubSite
Core concepts / Field types

Field types

All 44 built-in field types organised into 8 categories, with their type-specific config options.

Overview

FieldCraft ships with 44 field types in 8 categories. Each field type has a type string used in the schema and an optional config object with type-specific settings.

The QuestionType union also accepts custom strings — you can register your own field types via the field registry without modifying the core types.

Text fields (7)

TypeDescriptionKey config
short_textSingle-line text inputmaxLength, inputType ("text" | "password"), prefix, suffix
long_textMulti-line textarearows, maxLength, showCharCount
emailEmail input with built-in format validation
phonePhone number input
phone_internationalPhone with country code selector (249 countries)defaultCountry, priorityCountries
urlURL input
legal_nameStructured first/middle/last nameshowMiddleName, showSuffix
{
  id: 'bio',
  type: 'long_text',
  label: 'Tell us about yourself',
  config: {
    type: 'long_text',
    rows: 4,
    maxLength: 500,
    showCharCount: true,
  },
}

Numeric fields (6)

TypeDescriptionKey config
numberNumber input with optional boundsmin, max, step, prefix, suffix, decimalPlaces
sliderDraggable range slidermin (required), max (required), step, showValue, minLabel, maxLabel
ratingStar/heart/circle ratingmax (required), icon ("star" | "heart" | "circle")
npsNet Promoter Score (0–10)lowLabel, highLabel
likertAgreement scalelabels (required) — custom scale labels
opinion_scaleNumeric scale with endpoint labelsmin, max, minLabel, maxLabel
{
  id: 'satisfaction',
  type: 'rating',
  label: 'How satisfied are you?',
  required: true,
  config: {
    type: 'rating',
    max: 5,
    icon: 'star',
  },
}

Selection fields (6)

TypeDescriptionKey config
single_selectRadio buttonslayout ("vertical" | "horizontal" | "grid"), allowOther, otherLabel
multi_selectCheckboxeslayout, minSelections, maxSelections, allowOther
dropdownSelect menusearchable, multiple, allowOther
booleanYes/No togglestyle ("toggle" | "radio" | "checkbox"), trueLabel, falseLabel
country_selectCountry picker (249 countries)showFlags, priorityCountries, excludeCountries
rankingDrag-to-reorder listitems (required) — array of label/value pairs
{
  id: 'department',
  type: 'dropdown',
  label: 'Department',
  required: true,
  options: [
    { label: 'Engineering', value: 'eng' },
    { label: 'Design', value: 'design' },
    { label: 'Sales', value: 'sales' },
  ],
  config: { type: 'dropdown', searchable: true },
}

Date and time fields (4)

TypeDescriptionKey config
dateDate pickerminDate, maxDate, disablePast, disableFuture, format
date_rangeStart + end dateminDate, maxDate, maxRangeDays
timeTime pickerformat ("12h" | "24h"), minuteStep
appointmentDate + time slot pickerslotsUrl (API), slots (static), timezone, duration
{
  id: 'dob',
  type: 'date',
  label: 'Date of birth',
  required: true,
  config: {
    type: 'date',
    disableFuture: true,
    format: 'MM/DD/YYYY',
  },
}

Media fields (3)

TypeDescriptionKey config
file_uploadFile inputaccept (MIME types), maxSizeMb, maxFiles, uploadUrl
signatureCanvas signature padpenColor, backgroundColor, width, height
image_captureCamera/gallery photomaxSizeMb, camera ("front" | "back" | "any"), allowGallery
{
  id: 'document',
  type: 'file_upload',
  label: 'Upload your ID',
  required: true,
  config: {
    type: 'file_upload',
    accept: ['image/png', 'image/jpeg', 'application/pdf'],
    maxSizeMb: 10,
    maxFiles: 1,
  },
}

Advanced fields (7)

TypeDescriptionKey config
addressStructured address inputprovider ("google" | "mapbox" | "none"), apiKey, fields, defaultCountry
paymentStripe/PayPal paymentprovider (required), publicKey (required), amount | amountField, currency
matrixGrid of rows × columnsrows (required), columns (required), inputType ("radio" | "checkbox" | "text" | "number")
repeaterDynamic list of sub-fieldsfields (required), minEntries, maxEntries, addLabel, removeLabel
calculatedAuto-computed valueexpression (required), format ("number" | "currency" | "percentage"), decimalPlaces, prefix, suffix, visible
hiddenInvisible metadata fielddefaultValue, source ("url_param" | "cookie" | "referrer" | "static"), paramName
scoringOptions with numeric scoresoptions with score values, showScore, scoreRanges (min/max/label/color)
// Calculated field example — auto-compute BMI
{
  id: 'bmi',
  type: 'calculated',
  label: 'BMI',
  config: {
    type: 'calculated',
    expression: '{weight} / ({height} * {height})',
    format: 'number',
    decimalPlaces: 1,
    visible: true,
  },
}
// Matrix field example — satisfaction survey
{
  id: 'satisfaction_matrix',
  type: 'matrix',
  label: 'Rate each area',
  config: {
    type: 'matrix',
    rows: [
      { label: 'Communication', value: 'comm' },
      { label: 'Work-life balance', value: 'balance' },
      { label: 'Career growth', value: 'growth' },
    ],
    columns: [
      { label: 'Poor', value: '1' },
      { label: 'Fair', value: '2' },
      { label: 'Good', value: '3' },
      { label: 'Excellent', value: '4' },
    ],
    inputType: 'radio',
    required: 'all',
  },
}

Structural fields (4)

These fields organise content within a section. They don't collect values — you cannot add required or validation to them.

TypeDescriptionKey config
section_headerVisual heading within a sectionlevel ("h2" | "h3" | "h4"), showDivider
consentCheckbox with legal texttext (required), expandableText, checkboxLabel
info_blockStatic informational messagecontent (required), variant ("info" | "warning" | "success" | "error")
page_breakVisual break within a sectionlabel

Content and visual fields (7)

Display-only fields. Like structural fields, they don't collect values and cannot have required or validation.

TypeDescriptionKey config
welcome-screenIntro screen before questionsheading (required), description, imageUrl, buttonText, alignment
thank-you-screenCompletion screen after submitheading (required), description, redirectUrl, redirectDelay
rich-textRendered markdown or HTML blockcontent (required), format ("markdown" | "html")
imageStatic image displaysrc (required), alt (required), alignment, caption, link
videoEmbedded videosrc (required), provider ("youtube" | "vimeo" | "url"), autoplay
dividerHorizontal rulestyle ("solid" | "dashed" | "dotted"), color, thickness, spacing
spacerEmpty vertical spaceheight (required, in pixels)

Custom field types

You can register any string as a field type via the field registry. The QuestionType union includes (string & {}) — any custom type string is valid in a schema without modifying core types.

Next steps

On this page