Skip to content

Meta api for form fields #1111

@harry-whorlow

Description

@harry-whorlow

Continuation from the discussion #709. Listeners are implemented, however the meta field is yet to be started.

The proposal is to have the meta data available to the field component:

(example shamelessly ripped form #709)

<form.Field
  name="foo"
  meta={({ fieldApi }) => ({
    disabled: fieldApi.form.getFieldValue('someOtherField') == null,
    ...
  })}
  // or maybe expose values directly like form.Subscribe
  meta={({ values }) => ({
    disabled: values.someOtherField == null,
    ...
  })}
>
  {(field, meta) => <Comp
    disabled={meta.disabled}
    ...

You can subscribe to the meta from the Form but its pretty handy to have it available to the Field component.

I'm happy to give this a go, I just need the go ahead from a maintainer. 🤟

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions