FormProps

The props of a form component: TanStack options for the instance and the form element.

The props of a form component built from a config: the form's TanStack options again, for values only known while rendering, and what a <form> element takes besides submitting and content. ref reaches the <form> element.

Type parameters

NameDescription
TSchemaThe Standard Schema of the form; its input type is the form's data type.
TSubmitMetaWhat handleSubmit takes besides the values, as in TanStack's onSubmitMeta. Defaults to none.

Example

const EditProfile = ({ profile }: { profile: Profile }) => {
  const save = useSaveProfile()

  return (
    <ProfileForm
      className="max-w-prose"
      options={{ defaultValues: profile, onSubmit: ({ value }) => save.mutateAsync(value) }}
    />
  )
}

Members

Prop

Type

See also