Dead simple declarative bindings for Formik and Ant Design.
npm install formik-antd
!GitHub stars
!npm


Install for ant design 5 (beta)
``
`
npm i formik-antd@beta
`
Install for ant design 4
`
npm i formik-antd
name: string
- formik-antd v2 CodeSandbox (Ant Design 4)
formik-antd
Simple declarative bindings for Ant Design and Formik.
Core Concept
This library enriches several Ant Design components with a required prop that connects them to a Formik form field. It is quite simple. Instead of importing your form components from antd, you need to import them from 'formik-antd' and set their name prop. Now the component is connected/synced with the corresponding Formik field!
`
The Ant Design components are feature rich and provide a lot of props to customize their visual presentation. These features and also their apis stay exactly the same. Visit their documentation to learn more.
$3
jsx
`
import React from 'react'
import { Form, Input, InputNumber, Checkbox } from 'formik-antd'
import { Formik } from 'formik'
function App() {
return (
initialValues={{ firstName: '', age: 20, newsletter: false }}
render={() => (
)}
/>
)
}
`
Getting started
`
npm install formik-antd
import "antd/dist/antd.css"
Add to your index.js file or check the Advanced setup section
Core Components
| | Name | Props |
| ------------------ | ---------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| :white_check_mark: | AutoComplete | { name, validate?, fast? } & AutoCompleteProps |
| :white_check_mark: | Cascader | { name, validate?, fast? } & CascaderProps |
| :white_check_mark: | Checkbox | { name, validate?, fast? } & CheckboxProps |
| :white_check_mark: | Checkbox.Group | { name, validate?, fast? } & CheckboxGroupProps |
| :white_check_mark: | DatePicker | { name, validate?, fast? } & DatePickerProps |
| :white_check_mark: | DatePicker.WeekPicker | { name, validate?, fast? } & WeekPickerProps |
| :white_check_mark: | DatePicker.RangePicker | { name, validate?, fast? } & RangePickerProps |
| :white_check_mark: | DatePicker.MonthPicker | { name, validate?, fast? } & MonthPickerProps |
| :white_check_mark: | Input | { name, validate?, fast? } & InputProps |
| :white_check_mark: | InputNumber | { name, validate?, fast? } & InputNumberProps |
| :white_check_mark: | Input.Password | { name, validate?, fast? } & InputPasswordProps |
| :white_check_mark: | Input.TextArea | { name, validate?, fast? } & Input.TextAreaProps |
| :white_check_mark: | Mentions | { name, validate?, fast? } & MentionsProps |
| :white_check_mark: | Radio.Group | { name, validate?, fast? } & RadioGroupProps |
| :white_check_mark: | Rate | { name, validate?, fast? } & RateProps |
| :white_check_mark: | Select | { name, validate?, fast? } & SelectProps |
| :white_check_mark: | Slider | { name, validate?, fast? } & SliderProps |
| :white_check_mark: | Switch | { name, validate?, fast? } & SwitchProps |
| :white_check_mark: | Table | { name, fast? } & TableProps |
| :white_check_mark: | TimePicker | { name, validate?, fast? } & TimePickerProps |
| |
| :white_check_mark: | Transfer | { name, validate?, fast? } & TransferProps |
| :white_check_mark: | TreeSelect | { name, validate?, fast? } & TreeSelectProps |
Submitting and Resetting Forms
Directly under each container a