ErrorText
ErrorText<
T>(props):ReactElement
Defined in: ErrorText.tsx:37
Render the error messages of form fields
Parameters
Section titled “Parameters”Returns
Section titled “Returns”ReactElement
Remarks
Section titled “Remarks”- Shows what
form.getErrors()returns for each field: its errors once the field reports them - Renders a
<span data-error-text>holding a<span>for each field with errors, which holds a<span>per message, and nothing while there are none - Gives the
<span>of each field the id from errorTextId, which the standard bindings point the field's form control at witharia-describedbywhile the errors are reported. Show each field in oneErrorText, so that the id stays unique on the page. - Other props, such as
classNameandid, go to the outer<span> - Re-renders as the errors change, so the component that renders it need not be an observer
Example
Section titled “Example”<input {...form.bindInput("city", { ... })} /><ErrorText form={form} fields={["city"]} />
// One text for a row of fields<ErrorText form={form} fields={["city", "region", "postalCode"]} className="error" />Properties
Section titled “Properties”Props<
T> =Omit<React.HTMLAttributes<HTMLSpanElement>,"children"> &object
Defined in: ErrorText.tsx:7
Type Declaration
Section titled “Type Declaration”fields
Section titled “fields”fields: readonly
FormField.Name<T>[]
Fields to show the errors of
form:
Form<T>
Form the fields belong to