Introduction to the

Ant Plus is an enhanced version of Ant Design Forms that encapsulates an extremely simplified API for how forms are used and the components associated with them.

The document

nanxiaobei.github.io/ant-plus

The characteristics of

  • Very simple: Say goodbye to the tediousform.getFieldDecoratorBoilerplate code with verboserulesVerify the code.
  • Progressive enhancement: Without new functionality, components can be used as components in Ant Design.
  • Unified prompt: Can be defined globallyrulesVerify the prompt information, unified experience, say goodbye to the messy customization and uncontrollable.
  • Simplified API: Common APIS for form-related components have been simplified for smoother development.

The installation

Yarn

yarn add antx
Copy the code

npm

npm install antx
Copy the code

use

Example: codesandbox. IO/s/mqxxzrj87…

import { Form, Input, Button } from 'antx';

const Demo = ({ form }) = > (
  <Form api={form} data={{ username: 'Emily' }}>
    <Input
      label="Username"
      id="username"
      rules={['required', 'string', 'max=10']}
      max={10}
      msg="full"
    />
    <Button htmlType="submit">submit</Button>
  </Form>
);

export default Form.create()(Demo);
Copy the code

In the Props of the Form control, id is the unique identifier of the Form field, and label is the label of the form. Item. GetFieldDecorator (ID, options) Items in the options parameter can be used directly for Props of the component, such as rules and initialValue.

Ant Plus has also optimized Rules to use compact strings to set validation rules. At the same time provides a better experience of the verification prompt UI.

Yes, everything is so simple and clear. Refer to the Ant Plus Form component documentation for a complete usage guide.

contrast

Compare the code for constructing forms using Ant Plus with traditional Ant Design.

link

Making: github.com/nanxiaobei/…

NPM: www.npmjs.com/package/ant…

The last

Welcome to try, welcome to Star, and experience development in a way that has never been easier.