Docs
v1.4.1
GitHubSite
Core concepts / Field types

Field types

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

Overview

FieldCraft ships with 41 field types in 8 categories. In @squaredr/fieldcraft-react, all field components are built on shadcn/ui primitives (Radix UI + Tailwind CSS) for full keyboard navigation, dark mode theming, and WAI-ARIA compliance.

The QuestionType union also accepts custom strings — you can register your own field types or override any default field via the field registry without modifying 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 picker (Popover + Calendar)minDate, maxDate, disablePast, disableFuture, format
date_rangeStart + end dateminDate, maxDate, maxRangeDays
timeTime pickerformat ("12h" | "24h"), minuteStep
appointmentNative slot pickerslots (static array), duration, timezone, timezoneField, slotsUrl
{
  id: 'consultation',
  type: 'appointment',
  label: 'Book Consultation',
  required: true,
  config: {
    type: 'appointment',
    duration: 30,
    slots: [
      { date: '2026-09-01', times: ['09:00', '10:00', '11:00'] },
      { date: '2026-09-02', times: ['14:00', '15:00'] },
    ],
  },
}

FieldCraft OSS renders an accessible native slot picker button grid without requiring third-party iframe embeds. Advanced integrations (Calendly / Cal.com iframe bridges and live slot polling) are supported via Pro or custom field overrides.

Media fields (3)

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

FieldCraft OSS handles local client-side size and MIME validation cleanly. Cloud storage presigning (AWS S3, Cloudflare R2, Supabase) and client-side encryption can be seamlessly plugged in via Pro or customFields.

Advanced fields (7)

TypeDescriptionKey config
addressStructured address inputprovider ("google" | "mapbox" | "radar" | "none"), apiKey, fields, defaultCountry
paymentPayment metadata previewprovider, publicKey, amount | amountField, currency, serverUrl
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)
// Payment field configuration
{
  id: 'payment',
  type: 'payment',
  label: 'Order Total',
  required: true,
  config: {
    type: 'payment',
    provider: 'stripe',
    amount: 49.00,
    currency: 'USD',
    description: 'Pro Subscription',
  },
}

FieldCraft OSS renders a clear payment summary card with provider badges. Live interactive checkouts (Stripe Elements, PayPal Smart Buttons) are handled by @squaredr/fieldcraft-pro or your own custom field component.

The serverUrl is the endpoint your server exposes to create a PaymentIntent (or equivalent). The payment field POSTs { amount, currency, description } to this URL and expects a JSON response containing the clientSecret. Use responseMapping.clientSecretPath to specify where in the response JSON the client secret lives (e.g. "data.client_secret" for nested responses).

// 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