Meta api for form fields
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.7k
- Forks
- 682
- Avg merge
- 5d 18h
- Merged PRs (30d)
- 7
Description
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. 🤟
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing Form.Field API and the form.Subscribe pattern described in the issue. Compare how field components currently receive their arguments, then define how meta should be exposed and how the proposed callback or direct-values API behaves. Done means the Field component can access subscribed meta data as shown in the example, with the behavior agreed by a maintainer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100