All products

Build React forms with AI

Create a form in an Epic Stack application with labelled fields, accessible error messages and server validation using Conform and Zod.

When you build React forms with AI, begin with a failing submission. Someone has filled in a workshop registration form and mistyped an email address. Which field should they return to, and what message would actually help? The epic-forms skill connects an Epic Stack route action to a Conform form and a Zod schema, so the response can identify the offending field.

Work from a small example you can exercise in the browser. Add the visible label, required state and submission indicator before increasing the number of fields. If you accept a file, check the upload path and storage rules of your own application as a separate step.

What it does

  • Connect field labels to their inputs and errors.
  • Validate the submitted form values in a route action.
  • Show the pending state while a request is being processed.
  • Compare a successful submission with incomplete and invalid data.
  • Keep the form usable when browser JavaScript is unavailable.

Install and use

  1. Open the relevant route in a compatible Epic Stack project. Give the agent the data rules and where the form should submit.
  2. Describe a concrete failure, such as a registration address missing its domain, and ask for a useful message next to the email field.
  3. Test the page with fictitious values, navigate by keyboard and inspect the response from the server before accepting the change.

FAQ

Source

Made by Kent C. Dodds. Original skill: epic-forms, published on GitHub under the MIT licence.

View on GitHub