react-component / field-form

⚡️ React Performance First Form Component
https://field-form.react-component.now.sh/
MIT License
984 stars 267 forks source link

Propogate Fields state to Form #153

Open makarov-roman opened 4 years ago

makarov-roman commented 4 years ago

What problem does this feature solve?

It allows to get the current state of form (touched, valid) without iteration among all fields. There are multiple use-cases:

What does the proposed API look like?

I expect FormInstance to have methods/props isValid(are all fields valid), isTouched(is any field touched) The similar approach is implemented among such libraries as

Proposed API: I've used antd for example, if it's not ok I can update with plain rc-field-form

const FormComponent = () => {
  const [form] = Form.useForm()
  return <Form form={form}>
    <Button htmlType="submit" disabled={!form.isValid()}>Ok</Button>
  </Form>
}
anhkhoi commented 3 years ago

Any status? I think it's a useful feature.

ghmendonca commented 1 year ago

Almost 3 years later, and I would love to have this

bombillazo commented 1 year ago

This would be great to have.