gform-react

Features

Performant, type-safe React forms that work the same on the web, with native and Next.js Server Actions, and in React Native - no adapters, no casts, zero dependencies.

Lightweight & fast

  • Zero dependenciesNothing to install but React itself - react and react-dom are the only peers.

  • Tree-shakableImport only what you use to keep bundles small.

  • Minimal re-rendersOnly the fields that actually change re-render - never the whole form.

Validation

  • Native HTML constraintsrequired, min, max, pattern, minLength, maxLength, and more - each with a custom message.

  • Custom rulesAdd any synchronous rule with withCustomValidation.

  • Async validationRun asynchronous rules for server-side checks with withCustomValidationAsync.

  • Schema validationDrive the whole form from one Standard Schema (Zod, Yup, Valibot, ArkType) - zero runtime dependencies.

  • Cross-field validationRe-validate one field when another changes - like confirm-password - via validatorDeps.

Structure & inputs

  • Deeply nested formsStructure forms however you like, across any number of components.

  • Dynamic fieldsAdd or remove fields at runtime without losing state.

  • Real file inputstype="file" stores the real File object (or File[] with multiple), not the C:\fakepath\... string.

Platform & standards

  • Type-safeTyped state, toRawData(), and validators - all inferred from one form interface, no casts.

  • Native <form> actionsFull browser-level submission - action, method, and HTTP navigation - with no JavaScript required.

  • Next.js Server ActionsWorks through standard <form> submissions, with no special adapters or client wiring.

  • Accessibility-friendlyAutomatically manages aria-required and aria-invalid as validation state changes.

  • React NativeThe same model on web and mobile via gform-react/native.

Ready to build better forms?

Install gform-react and ship type-safe, performant forms in minutes.

$npm i gform-react
Read the docs →