Skip to main content

Field

Functions

Field

Field<Value, Key, Ref>(props): Element

A Field is a consumer of some data in its' parent Form. The user interface of a Field is completely determined by you, the developer. This component abstracts away all of the complexities of dealing with inputs, values, events, and validations.

function UserProfile() {
return (
<Form name="UserProfile" initialValues={{ firstName: "" }}>
<Field name="firstName" type="text" required pattern={/\w+/} as={({ input }) => <input {...input} />} />
</Form>
);
}

Type parameters

NameType
Valueextends FieldValue = FieldValue
Keyextends string = string
RefHTMLInputElement

Parameters

NameTypeDescription
propsWebFieldProps<Value, Key, Ref>FieldProps - The react props for the field component.

Returns

Element

Defined in

packages/react-formz-web/src/components/Field/Field.tsx:93