You are viewing beta documentation for Formie 4.x.
GraphQL

Query Forms

Formie exposes forms, pages, rows and fields through GraphQL. This is useful when you need to build your own front-end, inspect a form’s field layout, or fetch the settings your app needs before rendering a form.

Use formieForm when you expect one form, or formieForms when you need a list.

{
    formieForm(handle: "contactForm") {
        title
        handle
        isAvailable

        settings {
            errorMessageHtml
            submitMethod
            submitAction
        }

        pages {
            label

            rows {
                rowFields {
                    label
                    handle
                    typeName
                    inputTypeName

                    ... on Field_Name {
                        fields {
                            label
                            handle
                            enabled
                            required
                        }
                    }

                    ... on Field_Email {
                        placeholder
                        validateDomain
                    }
                }
            }
        }
    }
}

Form Queries

The formieForms, formieForm and formieFormCount queries accept Craft’s standard element query arguments, along with Formie’s handle argument.

ArgumentTypeDescription
handle[String]Narrows results by form handle.
id[QueryArgument]Narrows results by element ID.
uid[String]Narrows results by UID.
title[String]Narrows results by title.
searchStringNarrows results by a search query.
dateCreated[String]Narrows results by creation date.
dateUpdated[String]Narrows results by last-updated date.
offsetIntSets the offset for paginated results.
limitIntSets the result limit.
orderByStringSets the sort order.
fixedOrderBooleanReturns results in the order provided by the id argument.
inReverseBooleanReverses the result order.
archivedBooleanNarrows results to archived elements.
trashedBooleanNarrows results to soft-deleted elements.
uniqueBooleanReturns only elements with unique IDs.

Form Fields

Every form implements FormInterface.

FieldTypeDescription
handleStringThe form handle.
pages[PageInterface]The form’s pages.
rows(includeDisabled: Boolean)[RowInterface]The form’s rows.
formFields(includeDisabled: Boolean)[FieldInterface]The form’s fields.
settingsFormSettingsTypeThe form’s settings.
isAvailableBooleanWhether the form is available according to scheduling, user checks and other restrictions.

Use rows when you need the form’s layout structure. Use formFields when you just need the fields, without their row and page positions. Disabled fields are omitted by default; pass includeDisabled: true when you need them.

{
    formieForm(handle: "contactForm") {
        formFields(includeDisabled: true) {
            label
            handle
            visibility
        }
    }
}

Older examples may refer to fields such as templateHtml, csrfToken, captchas, submissionMutationName or submissionEndpoint on formieForm. Those values now live in the dedicated rendering and front-end payload queries covered in Rendering Forms.

Form Settings

The settings field exposes the form-level settings that commonly affect rendering and submission behavior.

FieldTypeDescription
displayFormTitleBooleanWhether to show the form title.
displayCurrentPageTitleBooleanWhether to show the current page title.
displayPageTabsBooleanWhether to show page tabs.
displayPageProgressBooleanWhether to show page progress.
progressPositionStringThe progress bar position.
progressValuePositionStringThe progress value position.
scrollToTopBooleanWhether the form should scroll to the top after submission.
defaultLabelPositionStringThe default field label position.
defaultInstructionsPositionStringThe default field instructions position.
requiredIndicatorStringHow required or optional fields are marked.
submitMethodStringThe submit method, such as page-reload or ajax.
submitActionStringThe submit action, such as message, entry, url or reload.
submitActionTabStringWhether redirects open in the same tab or a new tab.
submitActionFormHideBooleanWhether to hide the form after success.
automaticSubmissionStateBooleanWhether Formie should automatically restore an in-progress submission when the visitor returns.
submitActionMessageHtmlStringThe success message HTML.
submitActionMessageTimeoutIntThe success message timeout, in seconds.
submitActionMessagePositionStringThe success message position.
loadingIndicatorStringThe loading indicator type.
loadingIndicatorTextStringThe loading indicator text.
validationOnSubmitBooleanWhether to validate on submit.
validationOnFocusBooleanWhether to validate on focus.
errorMessageHtmlStringThe submit error message HTML.
errorMessagePositionStringThe error message position.
redirectUrlStringThe resolved redirect URL.
redirectEntryEntryInterfaceThe redirect entry, when the form redirects to an entry.
integrations[FormIntegrationsType]Enabled integrations for the form.

Pages And Rows

Pages expose their label, rows, fields and page settings.

FieldTypeDescription
labelStringThe page label.
rows[RowInterface]The page’s rows.
pageFields(includeDisabled: Boolean)[FieldInterface]The page’s fields.
settingsPageSettingsInterfacePage and button settings.

Rows expose rowFields(includeDisabled: Boolean), which is the list of fields in that row.

{
    formieForm(handle: "contactForm") {
        pages {
            label
            pageFields {
                handle
                label
            }
        }
    }
}

Page settings include page button labels, conditions, save buttons and client event data.

FieldTypeDescription
submitButtonLabelStringThe submit or next button label.
backButtonLabelStringThe back button label.
showBackButtonBooleanWhether the back button is shown.
saveButtonLabelStringThe save button label.
showSaveButtonBooleanWhether the save button is shown.
buttonsPositionStringThe page button position.
cssClassesStringCSS classes for the page buttons.
containerAttributes[FieldAttribute]Button container attributes.
inputAttributes[FieldAttribute]Button input attributes.
enablePageConditionsBooleanWhether page conditions are enabled.
pageConditionsJsonPage conditions.
enableNextButtonConditionsBooleanWhether next button conditions are enabled.
nextButtonConditionsJsonNext button conditions.
enableClientEventsBooleanWhether client event payloads are enabled for the page submit.
clientEventFieldsJsonKey/value rows for the client event payload.

Field Interface

Every field implements FieldInterface. Field-specific settings are available with GraphQL inline fragments.

FieldTypeDescription
labelStringThe field label.
handleStringThe field handle.
instructionsStringThe field instructions.
requiredBooleanWhether the field is required.
enabledBooleanWhether the field is enabled.
typeStringThe field’s PHP class.
displayNameStringThe field class name without the namespace.
typeNameStringThe field’s GraphQL type name.
inputTypeNameStringThe GraphQL input type to use when creating submissions.
matchFieldStringThe handle of another field this value should match.
placeholderStringThe field placeholder.
defaultValueStringThe field’s default value, when it can be represented as a string.
emailFieldSummaryValueStringThe value format used in email field summaries.
emailValueStringDeprecated alias for emailFieldSummaryValue.
prePopulateStringThe query-string parameter used to prefill the field’s initial value.
errorMessageStringThe field’s error message.
labelPositionStringThe label position.
instructionsPositionStringThe instructions position.
cssClassesStringField CSS classes.
containerAttributes[FieldAttribute]Field container attributes.
inputAttributes[FieldAttribute]Field input attributes.
includeInEmailFieldSummariesBooleanWhether the field is included in email field summaries.
includeInEmailBooleanDeprecated alias for includeInEmailFieldSummaries.
enableConditionsBooleanWhether field conditions are enabled.
conditionsJsonField conditions.
enableContentEncryptionBooleanWhether content encryption is enabled for this field.
visibilityStringThe field visibility.
{
    formieForm(handle: "contactForm") {
        formFields {
            label
            handle

            ... on Field_Dropdown {
                options {
                    label
                    value
                    isDefault
                }
            }

            ... on Field_Group {
                nestedRows {
                    fields {
                        label
                        handle
                    }
                }
            }
        }
    }
}

Field-Specific Settings

These fields are available through inline fragments in addition to the shared FieldInterface fields. The generated GraphQL schema remains the source of truth for a project, because element queries and third-party field types can change based on the installed plugins and the form’s field layout.

Address

Address inherits the nested field settings used by sub-field types.

FieldTypeDescription
nestedRows[RowInterface]The field’s nested rows.
fields[FieldInterface]The field’s nested fields.
subFieldLabelPositionStringThe label position for the sub-fields.

Agree

FieldTypeDescription
checkedValueStringThe value stored when the checkbox is checked.
uncheckedValueStringThe value stored when the checkbox is unchecked.
defaultValueStringThe default value as a string.
defaultStateBooleanWhether the field is checked by default.
descriptionHtmlStringThe field description HTML.

Calculations

FieldTypeDescription
formulaStringThe calculated formula as a JSON string.
formattingStringThe output formatting mode.
prefixStringText shown before the calculated value.
suffixStringText shown after the calculated value.
decimalsIntThe number of decimal places.

Categories

Categories inherits element field settings.

FieldTypeDescription
sourcesStringThe selected sources as a JSON string.
sourceStringThe selected source.
limitOptionsStringThe selectable item limit.
displayTypeStringThe front-end display type.
labelSourceStringWhere option labels should come from.
orderByStringThe element query sort order.
multiBooleanWhether multiple values can be selected.
layoutStringThe option layout.
defaultValueStringThe default value as a string.
defaultCategoryCategoryInterfaceThe default category element.
categories[CategoryInterface]The selectable category elements.
rootCategoryCategoryInterfaceThe root category element.

Checkboxes

Checkboxes inherits option field settings.

FieldTypeDescription
multiBooleanWhether multiple values can be selected.
layoutStringThe option layout.
options[FieldOption]The field options.
limitOptionsBooleanWhether selected options are limited.
minIntThe minimum number of selected options.
maxIntThe maximum number of selected options.
toggleCheckboxStringWhether a select-all checkbox is shown.
toggleCheckboxLabelStringThe select-all checkbox label.

Date/Time

FieldTypeDescription
defaultValueStringThe default value as a string.
displayTypeStringThe date/time display type.
defaultDateDateTimeThe default date value.
minDateDateTimeThe minimum allowed date.
maxDateDateTimeThe maximum allowed date.
datePickerOptions[FieldAttribute]Date picker options.

Dropdown inherits option field settings.

FieldTypeDescription
multiBooleanWhether multiple values can be selected.
layoutStringThe option layout.
options[FieldOption]The field options.

Email Address

FieldTypeDescription
blockedDomains[String]Domains that cannot be submitted.

Entries

Entries inherits element field settings.

FieldTypeDescription
sourcesStringThe selected sources as a JSON string.
sourceStringThe selected source.
limitOptionsStringThe selectable item limit.
displayTypeStringThe front-end display type.
labelSourceStringWhere option labels should come from.
orderByStringThe element query sort order.
multiBooleanWhether multiple values can be selected.
layoutStringThe option layout.
defaultValueStringThe default value as a string.
defaultEntryEntryInterfaceThe default entry element.
entries[EntryInterface]The selectable entry elements.

File Upload

File Upload inherits element field settings, except limitOptions and multi.

FieldTypeDescription
sourcesStringThe selected sources as a JSON string.
sourceStringThe selected source.
displayTypeStringThe front-end display type.
labelSourceStringWhere option labels should come from.
orderByStringThe element query sort order.
layoutStringThe option layout.
defaultValueStringThe default value as a string.
sizeLimitStringThe maximum file size.
sizeMinLimitStringThe minimum file size.
limitFilesStringThe file count limit.
allowedKinds[String]Allowed file kinds.
volumeHandleStringThe upload volume handle.

Group

FieldTypeDescription
nestedRows[RowInterface]The field’s nested rows.
fields[FieldInterface]The field’s nested fields.

Heading

FieldTypeDescription
headingSizeStringThe heading tag size.

Hidden

FieldTypeDescription
defaultOptionStringThe selected default value option.
queryParameterStringThe query-string parameter to read from.
cookieNameStringThe cookie name to read from.

HTML

FieldTypeDescription
htmlContentStringThe HTML or Twig content rendered for the field.

Multi-Line Text

FieldTypeDescription
limitBooleanWhether content length limits are enabled.
minIntThe minimum length.
minTypeStringWhether the minimum is counted as characters or words.
maxIntThe maximum length.
maxTypeStringWhether the maximum is counted as characters or words.
useRichTextBooleanWhether the field uses rich text.
richTextButtons[String]The enabled rich text buttons.
uniqueValueBooleanWhether the value must be unique.

Name

FieldTypeDescription
nestedRows[RowInterface]The field’s nested rows.
fields[FieldInterface]The field’s nested fields.
subFieldLabelPositionStringThe label position for the sub-fields.
useMultipleFieldsBooleanWhether the Name field uses multiple sub-fields.

Number

FieldTypeDescription
limitBooleanWhether numeric limits are enabled.
minIntThe minimum value cast to an integer.
maxIntThe maximum value cast to an integer.
minValueFloatThe minimum value.
maxValueFloatThe maximum value.
decimalsIntThe number of decimal places.

Payment

FieldTypeDescription
paymentIntegrationStringThe payment integration handle.
paymentIntegrationTypeStringThe payment integration class.
providerSettingsStringProvider settings as a JSON string.

Phone

FieldTypeDescription
countryOptions[CountryOption]The available country options.
countryEnabledBooleanWhether the country sub-field is enabled.
countryDefaultValueStringThe default country value.
countryAllowedStringAllowed countries as a JSON string.

Products

Products inherits element field settings.

FieldTypeDescription
sourcesStringThe selected sources as a JSON string.
sourceStringThe selected source.
limitOptionsStringThe selectable item limit.
displayTypeStringThe front-end display type.
labelSourceStringWhere option labels should come from.
orderByStringThe element query sort order.
multiBooleanWhether multiple values can be selected.
layoutStringThe option layout.
defaultValueStringThe default value as a string.
defaultProductProductInterfaceThe default product element.
products[ProductInterface]The selectable product elements.

Radio

Radio inherits option field settings.

FieldTypeDescription
multiBooleanWhether multiple values can be selected.
layoutStringThe option layout.
options[FieldOption]The field options.

Recipients

FieldTypeDescription
displayTypeStringThe front-end display type.
multipleBooleanWhether multiple recipients can be selected.
options[FieldOption]The recipient options.

Repeater

FieldTypeDescription
nestedRows[RowInterface]The field’s nested rows.
fields[FieldInterface]The field’s nested fields.
minRowsIntThe minimum number of rows.
maxRowsIntThe maximum number of rows.
addLabelStringThe add-row button label.

Section

FieldTypeDescription
borderStyleStringThe section border style.
borderWidthIntThe section border width.
borderColorStringThe section border color.

Signature

FieldTypeDescription
backgroundColorStringThe signature pad background color.
penColorStringThe signature pen color.
penWeightStringThe signature pen weight.

Single-Line Text

FieldTypeDescription
limitBooleanWhether content length limits are enabled.
minIntThe minimum length.
minTypeStringWhether the minimum is counted as characters or words.
maxIntThe maximum length.
maxTypeStringWhether the maximum is counted as characters or words.
uniqueValueBooleanWhether the value must be unique.

Summary

Summary only exposes the shared FieldInterface fields.

Table

FieldTypeDescription
columns[TableColumn]The table columns.

Tags

Tags inherits element field settings.

FieldTypeDescription
sourcesStringThe selected sources as a JSON string.
sourceStringThe selected source.
limitOptionsStringThe selectable item limit.
displayTypeStringThe front-end display type.
labelSourceStringWhere option labels should come from.
orderByStringThe element query sort order.
multiBooleanWhether multiple values can be selected.
layoutStringThe option layout.
defaultValueStringThe default value as a string.
defaultTagTagInterfaceThe default tag element.
tags[TagInterface]The selectable tag elements.

Users

Users inherits element field settings.

FieldTypeDescription
sourcesStringThe selected sources as a JSON string.
sourceStringThe selected source.
limitOptionsStringThe selectable item limit.
displayTypeStringThe front-end display type.
labelSourceStringWhere option labels should come from.
orderByStringThe element query sort order.
multiBooleanWhether multiple values can be selected.
layoutStringThe option layout.
defaultValueStringThe default value as a string.
defaultUserUserInterfaceThe default user element.
users[UserInterface]The selectable user elements.

Variants

Variants inherits element field settings.

FieldTypeDescription
sourcesStringThe selected sources as a JSON string.
sourceStringThe selected source.
limitOptionsStringThe selectable item limit.
displayTypeStringThe front-end display type.
labelSourceStringWhere option labels should come from.
orderByStringThe element query sort order.
multiBooleanWhether multiple values can be selected.
layoutStringThe option layout.
defaultValueStringThe default value as a string.
defaultVariantVariantInterfaceThe default variant element.
variants[VariantInterface]The selectable variant elements.

Supporting Types

These small object types are reused by field settings throughout the form schema.

FieldAttribute

FieldAttribute is used for custom attributes on fields and page buttons, such as containerAttributes, inputAttributes and datePickerOptions.

FieldTypeDescription
labelStringThe attribute name.
valueStringThe attribute value.

FieldOption

FieldOption is used by option-based fields such as Dropdown, Checkboxes, Radio and Recipients.

FieldTypeDescription
labelStringThe option label. For optgroups, this is resolved from the optgroup label.
valueStringThe option value. Optgroups return an empty string.
isOptgroupBooleanWhether the row is an optgroup.
isDefaultBooleanWhether the option is selected by default.
disabledBooleanWhether the option is disabled.

CountryOption

CountryOption is used by Phone fields for country-code options.

FieldTypeDescription
labelStringThe country label.
valueStringThe country value.
codeStringThe country calling code.

Table Columns

Table field settings expose columns, where each column is generated as a KeyValueType with these fields.

FieldTypeDescription
headingStringThe column heading.
handleStringThe column handle.
widthStringThe column width.
typeStringThe table column type.

Table field content also generates a form-specific table row type. The row fields come from the table’s column handles, and the value type depends on the column type.

Column typeGraphQL value type
dateDateTime
timeDateTime
numberNumber
lightswitchBoolean
Other column typesString