Skip to content

FormDTO

The FormDTO type defines the structure of a form, including its title, description, layout, and sections. It is the top-level object used to describe a form in a data-driven way.

Properties

NameTypeDescription
titlestring?The form's title (optional).
titleFontSizenumber?Font size for the title in rem units (optional).
descriptionstring?Description text for the form (optional).
descriptionFontSizenumber?Font size for the description in rem units (optional).
layoutLayoutDTO?Layout configuration for the entire form (optional).
sectionsSectionDTO[]Array of section definitions, each containing fields.

Example

ts
const formDTO: FormDTO = {
  title: "User Registration",
  titleFontSize: 2,
  description: "Please fill out all required fields.",
  descriptionFontSize: 1.2,
  layout: { col: 2, gap: "1rem" },
  sections: [
    {
      id: "personal",
      heading: "Personal Information",
      fields: [
        { id: "firstName", type: "text", label: "First Name", required: true },
        { id: "lastName", type: "text", label: "Last Name", required: true }
      ]
    }
  ]
};