final-form

v5.0.0 MIT

🏁 Framework agnostic, high performance, subscription-based form state management

Weekly Downloads
468.4K
Stars
3.0K
Forks
222
Open Issues
99
Gzip Size
6.2 kB
Unpacked Size
382.4 kB
Dependencies
2
Last Updated
10mo ago

final-form Download Trends

Download trends for final-form0695.6K1.4M2.1M2.8MFeb 2025MayAugNovFebApr 2026
final-form

About final-form

Final Form is a framework-agnostic library designed for high-performance, subscription-based form state management. It tackles the complexity inherent in managing form state, including values, validation, submission, and pristine/dirty tracking, by providing a declarative and efficient API that minimizes re-renders and optimizes performance.

The core philosophy of Final Form is to offer a powerful yet flexible foundation for form manipulation, suitable for developers building sophisticated user interfaces. It aims to provide granular control over form state updates through a subscription model, ensuring that only components truly dependent on specific state changes are re-rendered, leading to a smoother user experience.

Its primary API revolves around hooks and render props, abstracting the complexities of form state into a manageable structure. Key elements include the `useForm` hook or `<Form>` component, which provide access to `handleSubmit`, `formState`, and `registerField` (or field-level hooks like `useField`). This pattern allows developers to declaratively manage individual form fields and their associated states.

Final Form integrates seamlessly into various JavaScript ecosystems and frameworks, including React, by offering specific adapter packages. It can be used with build tools and state management patterns common in modern web development, providing a robust solution for managing complex form interactions within diverse application architectures.

With a bundle size of only 6.2 kB (gzipped), Final Form offers considerable power without a significant performance penalty. Its subscription-based architecture is designed for efficiency, delivering updates only to subscribed components. This focus on lean performance makes it a strong choice for applications where form interactions are frequent and critical.

While highly performant and adaptable, developers should be aware that the subscription model and the need to explicitly register fields might introduce a slight learning curve compared to simpler form solutions. However, this granular control is also its strength, allowing for highly optimized and complex form behaviors.

When to use

  • When managing complex form state with numerous fields and intricate validation rules, leveraging `registerField` and `formState`.
  • When optimizing re-renders in React applications by subscribing only relevant components to form state changes using `useField` or field-level subscriptions.
  • When building forms that require complex submission logic, including asynchronous validation and submission handling, via `handleSubmit` and `onSubmit`.
  • When developing a form-agnostic solution that can be integrated into different frontend frameworks, thanks to its framework-agnostic core.
  • When needing to track form state precisely, including pristine, dirty, submitting, and valid states, accessible through `formState`.
  • When building forms that need to programmatically reset or clear their state using `form.reset()` or similar imperative API calls.

When NOT to use

  • If your form has only a few static fields and minimal validation—a component's local state using `useState` might suffice.
  • If you are using a UI framework that provides its own opinionated and integrated form management solution, consider leveraging that first.
  • If you require a solution with absolutely zero external dependencies and are only managing very basic input binding.
  • If your application's state management needs are entirely met by global state solutions and forms are not a significant complexity factor.
  • If the overhead of understanding and implementing a subscription-based state management pattern for forms is prohibitive for your current project scope.

final-form Alternatives

final-form Categories