T
TanStack13mo ago
fascinating-indigo

Mantine, Tanstack & Zod validation error display

When wrapping a Mantine input component in a Tanstack Field wrapper, is this the correct way to display an error message? It works,, but I haven't found any documentation suggesting this route or gotten anything else to work with this trifecta. Thanks!
No description
4 Replies
fascinating-indigo
fascinating-indigoOP13mo ago
Basically if there is a Zod validation error in the field meta, it displays it and puts the field into an 'error' state with the associated red outline formatting.
genetic-orange
genetic-orange13mo ago
error={state.meta.errors[0]} Why are you passing form={form} to the <Field />?
fascinating-indigo
fascinating-indigoOP13mo ago
ah thanks. form is required by the FieldAPI
No description
fascinating-indigo
fascinating-indigoOP13mo ago
I hadn't considered why but I guess when used with Mantine, the Field object doesn't know which form it's associated with.

Did you find this page helpful?