0.1.17 • Published 4 years ago

antd-final-form v0.1.17

Weekly downloads
8
License
MIT
Repository
github
Last release
4 years ago

antd-final-form

All Contributors

Simple declarative bindings for Ant Design and React Final Form.

Core Concept

This library enriches several Ant Design components with props that connects them to a Final-Form field. It is quite simple. Instead of importing your form components from antd, you need to import them from 'antd-final-form' and set their name prop.

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.

Example:

import * as React from 'react';
import { AntdInput } from 'antd-final-form';
import { Form, Field } from 'react-final-form';
import 'antd/dist/antd.css';

export const required = (value: string | number) => (value ? undefined : '* Required');

export default function App() {
  return (
    <Form
      onSubmit={(values) => console.log(values)}
      initialValues={{ firstName: 'Larry', lastName: 'hello' }}
      render={({ handleSubmit, form, submitting, pristine, values }) => (
        <form onSubmit={handleSubmit}>
          <Field
            label='test'
            name='firstName'
            validate={required}
            component={AntdInput}
            placeholder='First Name'
          />
          <Field name='lastName' label='Last Name' component={AntdInput} />
          <pre>{JSON.stringify(values)}</pre>
        </form>
      )}
    />
  );
}

Getting started

npm install antd-final-form

Add import "antd/dist/antd.css" to your index.js file.

Core Components

NameProps
:white_check_mark:InputInputProps
:white_check_mark:SubmitButtonButtonProps

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

0.1.17

4 years ago

0.1.10

4 years ago

0.1.11

4 years ago

0.1.12

4 years ago

0.1.13

4 years ago

0.1.16

4 years ago

0.1.8

4 years ago

0.1.9

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.7

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.0

4 years ago