Check out our talk at Remix Conf!

Field layout

In this example, we use a custom layout for our fields.

const schema = z.object({
  street: z.string().nonempty(),
  number: z.string().nonempty(),
  extendedAddress: z.string().optional(),
  city: z.string().nonempty(),
  state: z.enum(['Alabama', 'Alaska', 'Arizona']),
})

export default () => (
  <Form schema={schema}>
    {({ Field, Errors, Button }) => (
      <>
        <div className="flex space-x-4">
          <Field name="street" className="flex-[3]" />
          <Field name="number" className="flex-[1]" />
        </div>
        <Field name="extendedAddress" />
        <div className="flex space-x-4">
          <Field name="city" className="flex-1" />
          <Field name="state" />
        </div>
        <Errors />
        <Button />
      </>
    )}
  </Form>
)