Skip to content

FieldDTO

The FieldDTO type defines an individual field within a section of a form. It specifies the field's type, label, validation, layout, and other properties.

Properties

NameTypeDescription
idstringUnique identifier for the field.
typeInputTypeType of input (e.g., "text", "email", "select", etc.).
labelstringField label to display.
placeholderstring?Placeholder text (optional).
optionsstring[]?Options for select/autocomplete fields (optional).
requiredboolean?Whether the field is required (optional).
disabledboolean?Whether the field is disabled (optional).
defaultValueany?Default value for the field (optional).
layout{ col?: number }?Field-level layout (e.g., starting column, optional).
validationsValidations?Validation rules for the field (optional).

Example

ts
const field: FieldDTO = {
  id: "firstName",
  type: "text",
  label: "First Name",
  placeholder: "Enter your first name",
  required: true,
  validations: {
    minLength: 2,
    maxLength: 30,
    pattern: /^[A-Za-z]+$/
  }
};