Formik

Formik: Build React Forms Without the Tears - Docs & Guide

Library
npm
v2.4.9
34,320 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
53 /100 Fair
Development Activity 0
Maintenance 44
Community 68
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
75 /100 Good
Architecture 78
Code Quality 80
Innovation 74
Learning Curve 68

Formik is a React library for managing form state, validation, and submission without hand-rolling controlled-input wiring for every field. It centralizes values, touched state, and errors in a single store accessible via hooks (useFormik, useField) or the <Formik> render-prop/component API, so forms of any size stay declarative instead of accumulating dozens of individual useState calls.

Validation can be handled with a plain validation function or, more commonly, a Yup schema passed via validationSchema, giving type-safe, declarative validation rules that Formik automatically maps to per-field error messages. <Field>, <FieldArray>, <Form>, and <ErrorMessage> components cover the common cases of text inputs, dynamic list fields, form submission, and error rendering respectively.

What You Get

  • useFormik/<Formik> - the core hook and component managing values, errors, touched state, and submission handling for an entire form
  • <Field>/useField - per-field bindings that connect an input to Formik’s state without manual onChange/value wiring
  • <FieldArray> - manages dynamic, repeatable field groups (e.g. a list of phone numbers or line items) with add/remove/reorder helpers
  • Built-in Yup schema validation support via validationSchema, plus support for a custom validate function for non-Yup validation
  • withFormik higher-order component for class-component codebases that predate hooks

Common Use Cases

  • Multi-field signup, login, or checkout forms needing per-field validation messages and submit-state handling (isSubmitting, isValid)
  • Dynamic forms where users add/remove repeated groups of fields (e.g. multiple addresses or line items) via FieldArray
  • Forms requiring schema-based validation shared between client and server logic, using a single Yup schema as the source of truth
  • Wizard-style multi-step forms that need to preserve values and validation state as the user moves between steps

Under The Hood

Architecture The core lives in packages/formik/src/Formik.tsx (1219 lines), a single component/hook implementation built around a reducer-style internal state object (values, errors, touched, isSubmitting, isValidating) exposed to descendants through FormikContext; Field.tsx and FastField.tsx connect individual inputs to that context via useField, while FieldArray.tsx (392 lines) layers array-specific mutation helpers (push/remove/insert/swap/move) on top of the same context using an internal array-helpers class. Tech Stack A TypeScript-first monorepo (94% TS) managed with Turborepo/yarn workspaces, containing the formik core package and a separate formik-native package for React Native; validation integrates with Yup as an optional peer, and the build targets both CJS and ESM outputs. Code Quality Test coverage is deep and long-standing: packages/formik/test/ has dedicated suites for Formik.test.tsx, Field.test.tsx, FieldArray.test.tsx, withFormik.test.tsx, ErrorMessage.test.tsx, utils.test.tsx, plus a types.test.tsx file specifically asserting the public TypeScript types compile correctly — an unusually rigorous check for a UI library. E2E coverage is added via Playwright (playwright.config.ts, e2e/ directory) on top of the unit suite. API Design The API balances hooks (useFormik, useField) for modern function components against a still-supported withFormik HOC and render-prop <Formik> component for legacy code, which does add surface area to learn, but the common path (<Formik> + <Field> + validationSchema) requires very little boilerplate to get a validated form working, which explains its dominant adoption in the React ecosystem despite competition from newer, smaller libraries like react-hook-form.

Used by 20 apps in this directory

TypeScript
96%
Other

Amplication

AI Code Assistants · Automation · Developer Tools

16,015

Create production-ready backend services with your organization's standards baked in — generating NestJS, Prisma, and GraphQL code that you own and control.

View details
58
Repo Health
84
Technical
60
Dependency
Built with
TypeScript 96%
Updated 3 months ago
Rust
86%
Other

Arroyo

Analytics · Data Engineering

5,039

A distributed stream processing engine written in Rust that lets you write SQL to run stateful, real-time computations over data streams with subsecond results.

View details
86
Repo Health
74
Technical
62
Dependency
Built with
Rust 86%
Updated 1 weeks ago
TypeScript
97%
AGPL 3.0

Bigcapital

Invoicing Finance

3,916

Self-hostable double-entry accounting platform with invoicing, inventory, multi-currency, and real-time financial reporting for small and medium businesses.

View details
90
Repo Health
77
Technical
61
Dependency
Built with
TypeScript 97%
Updated 6 days ago
Go
75%
AGPL 3.0

Coder

Code Editors · Developer Tools · Devops

16,729

Self-hosted cloud development environments and AI coding agents — defined in Terraform, connected via WireGuard, automatically shut down when idle.

View details
91
Repo Health
90
Technical
65
Dependency
Built with
Go 75%
TypeScript 23%
Updated 4 days ago
TypeScript
45%
Other

Convex Backend

Databases · Developer Tools

12,617

Open-source reactive database that lets developers build live-updating apps with pure TypeScript, strong consistency, and real-time subscriptions—no separate API layer required.

View details
87
Repo Health
82
Technical
68
Dependency
Built with
TypeScript 45%
Rust 43%
Updated 6 days ago
Go
49%
Other

Cosmos-Server

Authentication · Security

6,167

All-in-one self-hosted home server with SmartShield anti-DDoS, Nebula mesh VPN, automatic HTTPS, and a 250-app marketplace — all secured behind a unified auth layer.

View details
83
Repo Health
59
Technical
64
Dependency
Built with
Go 49%
JavaScript 48%
Updated 1 weeks ago
Go
74%
Other

Flipt

Developer Tools · Devops

4,911

Git-native feature flag platform that stores, versions, and deploys feature toggles directly in your own Git repositories with no external database required.

View details
90
Repo Health
83
Technical
69
Dependency
Built with
Go 74%
TypeScript 25%
Updated 4 days ago
TypeScript
62%
Other

Flowise

AI Development · Automation · Developer Tools

55,490

Drag-and-drop visual builder for AI agents, RAG pipelines, and multi-agent systems—deploy anywhere in minutes.

View details
82
Repo Health
77
Technical
63
Dependency
Built with
TypeScript 62%
JavaScript 27%
Updated 1 months ago
Go
62%
Apache 2.0

Harness Open Source

Code Editors · Developer Tools · Devops

38,450

A unified open source DevOps platform combining Git hosting, CI/CD pipelines, cloud development environments, and artifact registries in a single self-hosted system.

View details
89
Repo Health
79
Technical
64
Dependency
Built with
Go 62%
TypeScript 33%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers