Skip to main content

Form

A powerful form component with client-side validation, AJAX submission, and seamless Extbase integration.

Use `https://down.example.com` to preview the generic error state.

Features

See the complete Form Guide for a complete form integration.

Installation

typo3 ui:add form

Read more about installing Components and Primitives.

Client-side validation is configured in your entry file with the validation option, not in the Fluid template. Pass either a Standard Schema-compatible validator such as Zod or a synchronous callback that reads the values object. values uses your field names as dot paths such as person.name, keeps leaf values as string | File, exposes arrays through getAll(), and can be converted to a nested object with toObject() or partially read with pick(). Validation and server errors stay flat and field-keyed, so nested fields still return errors under keys such as person.name. For submit results, return true, false, or field errors from onSubmit, and use api.setErrorText() or api.setSuccessText() for form-level messages. Use post(url) to submit the current form as FormData.

API Reference

The following tables cover the available props of the Fluid Primitives.

form.root

Submits and manages the form state. Renders a <form> element.

NameDescriptionRequiredDefault
actionUristring
The resolved form action URI to submit to directly.
No
-
actionstring
The Extbase action name used to build the form action URI.
No
-
extensionNamestring
The Extbase extension name used to build the form action URI.
No
-
pluginNamestring
The Extbase plugin name used to build the form action URI.
No
-
controllerstring
The Extbase controller name used to build the form action URI.
No
-
argumentsarray
The Extbase arguments used to build the form action URI.
No
-
pageUidint
The target page UID used to build the form action URI.
No
-
objectNamestring
The object name prefix used for nested form field names.
No
-
objectmixed
The bound object used for form value mapping.
No
-
methodstring
The HTTP method used for form submission.
No
'post'

form.content

Wraps the editable form UI. It stays visible in ready, invalid, and submitting, and hides in error and success. Renders a <div> element.

form.indicator

Displays content for an exact form state such as error, success, or submitting. Renders a <div> element.

NameDescriptionRequiredDefault
stateEnum\FormState
The form state to render.
Yes
-

form.errorText

Displays the current form-level error text set through the Form API, or its slotted fallback text. Renders a <span> element.

form.successText

Displays the current form-level success text set through the Form API, or its slotted fallback text. Renders a <span> element.

Anatomy

<primitives:form.root>
    <primitives:form.content>
        <primitives:field.root>
            <primitives:field.label />
            <primitives:field.control asChild="{true}">
                <!-- Your form input here -->
            </primitives:field.control>
            <primitives:field.error />
        </primitives:field.root>
    </primitives:form.content>

    <primitives:form.indicator state="{f:constant(name: 'Jramke\FluidPrimitives\Enum\FormState::Error')}">
        <primitives:form.errorText />
    </primitives:form.indicator>
</primitives:form.root>