formik
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "formik" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-e37441dabee7e1cac3372e11b6daefe120202f955af48b6aa2eddeaf2f5d7bc0. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Formik: A library for building and managing forms in React. Use for scenarios that require form validation, multi-step forms, dynamic form fields, or handling form submissions with error states.
Introduction source: third_party · TerminalSkills · 1.0.0 Reference
SkillPi interpretation
- Testing
- Not tested
Browse files
Frontmatter
name: formik
description: >-
Build forms in React with Formik. Use when creating complex forms with
validation, multi-step forms, dynamic form fields, or handling form
submission with error states.
license: Apache-2.0
compatibility: 'React 16+'
metadata:
author: terminal-skills
version: 1.0.0
category: development
tags: [formik, forms, react, validation, ui]Formik
Overview
Formik manages form state in React — values, errors, touched fields, submission. Integrates with Yup/Zod for schema validation. Handles complex forms (multi-step, dynamic fields, arrays) without Redux or complex state management.
Instructions
Step 1: Basic Form
import { Formik, Form, Field, ErrorMessage } from 'formik'
import * as Yup from 'yup'
const SignupSchema = Yup.object({
name: Yup.string().min(2).required('Name is required'),
email: Yup.string().email('Invalid email').required('Email is required'),
password: Yup.string().min(8, 'At least 8 characters').required('Password is required'),
})
function SignupForm() {
return (
<Formik
initialValues={{ name: '', email: '', password: '' }}
validationSchema={SignupSchema}
onSubmit={async (values, { setSubmitting, setErrors }) => {
try {
await api.signup(values)
} catch (err) {
setErrors({ email: 'Email already registered' })
} finally {
setSubmitting(false)
}
}}
>
{({ isSubmitting }) => (
<Form>
<Field name="name" placeholder="Name" />
<ErrorMessage name="name" component="span" className="error" />
<Field name="email" type="email" placeholder="Email" />
<ErrorMessage name="email" component="span" className="error" />
<Field name="password" type="password" placeholder="Password" />
<ErrorMessage name="password" component="span" className="error" />
<button type="submit" disabled={isSubmitting}>Sign Up</button>
</Form>
)}
</Formik>
)
}
Step 2: Dynamic Field Arrays
import { FieldArray } from 'formik'
function TeamForm() {
return (
<Formik initialValues={{ members: [{ name: '', role: '' }] }} onSubmit={handleSubmit}>
{({ values }) => (
<Form>
<FieldArray name="members">
{({ push, remove }) => (
<>
{values.members.map((_, i) => (
<div key={i}>
<Field name={`members.${i}.name`} placeholder="Name" />
<Field name={`members.${i}.role`} as="select">
<option value="">Select role</option>
<option value="admin">Admin</option>
<option value="member">Member</option>
</Field>
<button type="button" onClick={() => remove(i)}>Remove</button>
</div>
))}
<button type="button" onClick={() => push({ name: '', role: '' })}>
Add Member
</button>
</>
)}
</FieldArray>
</Form>
)}
</Formik>
)
}
Guidelines
- For new projects, consider react-hook-form (less re-renders). Formik is still solid for existing projects.
- Use schema validation (Yup/Zod) instead of manual validate functions.
setErrorsin onSubmit handles server-side validation errors (duplicate email, etc.).<ErrorMessage>only shows after field is touched — good UX by default.- For large forms, use
enableReinitializewhen initial values come from API.
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供 Formik 构建 React 表单的完整解决方案
- 覆盖基础表单、动态字段数组等实用场景
- 适用于前端开发中的表单处理需求
Highlights
- description 明确描述适用场景,触发词精准完整
- 覆盖复杂表单、验证、多步骤表单等多种变体
- 边界清晰,不易误触或漏触
Highlights
- 结构清晰,分步骤说明,包含端到端代码示例
- frontmatter 完整,单文件未超过 500 行
- 包含 Guidelines 提供额外最佳实践
Highlights
- 工具来源明确(Formik、Yup),参数使用正确
- 覆盖表单验证、动态字段、错误处理等异常场景
- 不可逆操作(如提交)有状态管理和错误处理机制
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.