Skip to content

Remix Validated Form v3.2.0

Choose a tag to compare

@airjp73 airjp73 released this 16 Jan 00:50
· 1409 commits to main since this release

New Features

getInputProps

useField is now a lot simpler to use for most cases thanks to the new getInputProps. You can read about it in more detail here.

import { useField } from "remix-validated-form";

type MyInputProps = {
  name: string;
  label: string;
};

export const MyInput = ({ name, label }: InputProps) => {
  const { error, getInputProps } = useField(name);
  return (
    <div>
      <label htmlFor={name}>{label}</label>
      <input {...getInputProps({ id: name })} />
      {error && (
        <span className="my-error-class">{error}</span>
      )}
    </div>
  );
};

Touched states

It is now possible to track the touched state of a field with the touched and setTouched return values of useField (docs).

hasBeenSubmitted in form context

You can now determine if the user has attempted to submit the form using hasBeenSubmitted from useFormContext (docs).

Docs changes

The props headers in the reference section are now linkable. 😄

PRs

Includes #25