Booleans

In this example, all sorts of boolean schemas are validated on the client and on the server.

const schema = z.object({
  mandatory: z.boolean(),
  optional: z.boolean().optional(),
  nullable: z.boolean().nullable(),
  defaultFalse: z.boolean().default(false),
  defaultTrue: z.boolean().default(true),
})

const mutation = applySchema(schema)(async (values) => values)

export const action = async ({ request }: Route.ActionArgs) =>
  formAction({ request, schema, mutation })

export default () => <SchemaForm schema={schema} />