Remix Form Library

screenshot of Remix Form Library

An easy way to validate your remix forms client and server side

Overview

The Remix Form Library is a minimalist library designed to validate forms end to end, from server to client. It provides functions to perform client-side and server-side validations, allowing for seamless error handling.

Features

  • useInput: This function enables atomic client-side validations using zod. The validate function is triggered with the onChange event.
  • useServerInput: Similar to useInput, this function also supports client-side validations. Additionally, it listens to the data returned in the action function through the useActionData hook or a fetcher. Client-side validation takes priority over server errors, ensuring that any client errors are displayed first.

Summary

The Remix Form Library is a lightweight solution for validating forms in remix applications. It offers two key functions, useInput and useServerInput, to handle client-side and server-side validations seamlessly. By providing consistent and reliable error handling, this library simplifies the form validation process for developers.