Skip to main content

Field

A form field wrapper that provides accessible labeling, error handling, and state management for form inputs.

Choose a unique username for your account.

Features

Installation

typo3 ui:add field

Read more about installing Components and Primitives.

Examples

Required Field

Mark a field as required.

With Description

Add helpful description text below the input.

Must be at least 8 characters long.

Invalid State

Indicate that the field has an error and display an error message.

The password must be at least 8 characters long.

Disabled Field

Disable the entire field.

With Checkbox

Use with the Checkbox component.

API Reference

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

field.root

Provides shared field state for labels, descriptions, errors, and controls. Renders a <div> element.

NameDescriptionRequiredDefault
namestring
The unique field name used to associate labels, descriptions, errors, and form values.
Yes
-
disabledboolean
Whether the field is disabled.
No
-
invalidboolean
Whether the field is invalid.
No
-
requiredboolean
Whether the field is required.
No
-
readOnlyboolean
Whether the field is read-only.
No
-
defaultValuemixed
The initial value that child controls can use when rendered inside the field.
No
-

field.label

Labels the associated form control. Renders a <label> element.

field.control

Wraps the slotted form control and wires up shared field attributes. Renders the element defined by the asChild prop.

field.description

Displays help or supporting text for the field. Renders a <div> element.

field.error

Displays validation error messages for the field. Renders a <div> element.

Anatomy

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