# jaredpalmer/formik architecture

> Architecture diagram of the GitHub repository jaredpalmer/formik, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jaredpalmer/formik
- Repository: https://github.com/jaredpalmer/formik

## Overview

Formik is a React library for building forms. The principal workflow is to configure a form with initial values and a submit handler, manage its state and validation through Formik, expose that state to fields and helper components, and handle submission. The graph includes the main field variants, array fields, context connection, higher-order form API, and shared utilities. Relationships are limited to imports and calls shown in the excerpts or SOURCE INDEX; Form and package entrypoint wiring is not inferred.

Main entry points: [`packages/formik/src/Formik.tsx`](https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/Formik.tsx) (Formik Form), [`packages/formik/src/Field.tsx`](https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/Field.tsx) (Field), [`packages/formik/src/FormikContext.tsx`](https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/FormikContext.tsx) (Formik Context), [`packages/formik/src/connect.tsx`](https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/connect.tsx) (Context Connector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_form_runtime["Form Runtime"]
  node_form_builder["Formik Form<br/>[Formik.tsx]"]
  node_form_element["Form Element<br/>[Form.tsx]"]
  node_form_hoc["withFormik API<br/>[withFormik.tsx]"]
end

subgraph group_field_components["Field Components"]
  node_field["Field<br/>[Field.tsx]"]
  node_fast_field["FastField<br/>[FastField.tsx]"]
  node_field_array["FieldArray<br/>[FieldArray.tsx]"]
  node_error_message["ErrorMessage<br/>[ErrorMessage.tsx]"]
end

subgraph group_shared_layer["Shared Layer"]
  node_context["Formik Context<br/>[FormikContext.tsx]"]
  node_connector["Context Connector<br/>[connect.tsx]"]
  node_types["Form Types<br/>[types.tsx]"]
  node_utilities["Form Utilities<br/>[utils.ts]"]
end

node_developer(("React Developer"))

node_developer -.->|"configures forms"| node_form_builder
node_form_builder -->|"provides state"| node_context
node_form_builder -->|"updates nested state"| node_utilities
node_field -->|"reads context"| node_context
node_field -->|"registers fields"| node_form_builder
node_form_builder -->|"uses field config"| node_field
node_form_builder -->|"wraps form API"| node_form_hoc
node_fast_field -->|"connects context"| node_connector
node_field_array -->|"connects context"| node_connector
node_error_message -->|"connects context"| node_connector
node_connector -->|"consumes context"| node_context
node_field -->|"uses helpers"| node_utilities
node_form_builder -->|"uses contracts"| node_types
node_field -->|"uses contracts"| node_types
node_context -->|"uses contracts"| node_types

click node_form_builder "https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/Formik.tsx"
click node_form_element "https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/Form.tsx"
click node_form_hoc "https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/withFormik.tsx"
click node_field "https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/Field.tsx"
click node_fast_field "https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/FastField.tsx"
click node_field_array "https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/FieldArray.tsx"
click node_error_message "https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/ErrorMessage.tsx"
click node_context "https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/FormikContext.tsx"
click node_connector "https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/connect.tsx"
click node_types "https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/types.tsx"
click node_utilities "https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/utils.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_form_builder,node_form_element,node_form_hoc toneBlue
class node_field,node_fast_field,node_field_array,node_error_message toneAmber
class node_context,node_connector,node_types,node_utilities toneMint
class node_developer toneIndigo
```

## Components

### Form Runtime

- [Formik Form](https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/Formik.tsx): `packages/formik/src/Formik.tsx`
- [Form Element](https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/Form.tsx): `packages/formik/src/Form.tsx`
- [withFormik API](https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/withFormik.tsx): `packages/formik/src/withFormik.tsx`

### Field Components

- [Field](https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/Field.tsx): `packages/formik/src/Field.tsx`
- [FastField](https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/FastField.tsx): `packages/formik/src/FastField.tsx`
- [FieldArray](https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/FieldArray.tsx): `packages/formik/src/FieldArray.tsx`
- [ErrorMessage](https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/ErrorMessage.tsx): `packages/formik/src/ErrorMessage.tsx`

### Shared Layer

- [Formik Context](https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/FormikContext.tsx): `packages/formik/src/FormikContext.tsx`
- [Context Connector](https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/connect.tsx): `packages/formik/src/connect.tsx`
- [Form Types](https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/types.tsx): `packages/formik/src/types.tsx`
- [Form Utilities](https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/utils.ts): `packages/formik/src/utils.ts`

### Other components

- **React Developer**

## Connections

- React Developer → Formik Form: configures forms (evidence: `README.md`)
- Formik Form → Formik Context: provides state (evidence: `packages/formik/src/Formik.tsx`)
- Formik Form → Form Utilities: updates nested state (evidence: `packages/formik/src/Formik.tsx`)
- Field → Formik Context: reads context (evidence: `packages/formik/src/Field.tsx`)
- Field → Formik Form: registers fields (evidence: `packages/formik/src/Field.tsx`)
- Formik Form → Field: uses field config (evidence: `packages/formik/src/Formik.tsx`)
- Formik Form → withFormik API: wraps form API (evidence: `packages/formik/src/withFormik.tsx`)
- FastField → Context Connector: connects context (evidence: `packages/formik/src/FastField.tsx`)
- FieldArray → Context Connector: connects context (evidence: `packages/formik/src/FieldArray.tsx`)
- ErrorMessage → Context Connector: connects context (evidence: `packages/formik/src/ErrorMessage.tsx`)
- Context Connector → Formik Context: consumes context (evidence: `packages/formik/src/connect.tsx`)
- Field → Form Utilities: uses helpers (evidence: `packages/formik/src/Field.tsx`)
- Formik Form → Form Types: uses contracts (evidence: `packages/formik/src/Formik.tsx`)
- Field → Form Types: uses contracts (evidence: `packages/formik/src/Field.tsx`)
- Formik Context → Form Types: uses contracts (evidence: `packages/formik/src/FormikContext.tsx`)
