Render forms with validation and submission
This library uses Tanstack Form under the hood. It works by letting you pass configurable options related to InstantDB, and also allows passing any custom options to Tanstack Form. It then handles updates and syncing for you.
This is a simple example of an update form for the Items table. It doesn’t cover all the available features, but should give you a good starting point.
handleIDBUpdate
and handleIDBCreate
which can be called to automatically update/create in InstantDB with the latest values in the form. zodSchema
is also automatically created for you based on your Instant schema.form.Field
component. This component is a wrapper around the Tanstack Form Field component, and automatically gives you typesafe field values.Form state is managed under the hood using the @tanstack/react-form
library with the useForm
hook. See the docs for more information. You can pass all of the original useForm
parameters to the tanstackOptions
object. form.Field
also uses the same API, so you have access to all tanstack form field values, such as field.state.meta
Read the reference for the useForm hook
In the next page, we’ll cover a more complex example with all of the available features, including creating a reusable component that works for both create and update forms, handling relationship picker fields, debouncing, and more.