T
TanStack10mo ago
flat-fuchsia

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
flat-fuchsia
flat-fuchsiaOP10mo 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.
dependent-tan
dependent-tan10mo ago
error={state.meta.errors[0]} Why are you passing form={form} to the <Field />?
flat-fuchsia
flat-fuchsiaOP10mo ago
ah thanks. form is required by the FieldAPI
No description
flat-fuchsia
flat-fuchsiaOP10mo 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?