Check out our talk at Remix Conf!


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

const schema = z.object({
  mandatory: z.enum(['one', 'two', 'three']),
  optional: z.enum(['one', 'two', 'three']).optional(),
  nullable: z.enum(['one', 'two', 'three']).nullable(),
  default: z.enum(['one', 'two', 'three']).default('two'),

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

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

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