#reusable form field components

6 messages · Page 1 of 1 (latest)

lucid rampart
#

Hi everyone, I'm using TanStack Form with SolidJS, and I'm trying to extract some reusable form field components so I can use them across different forms more easily.

For example, I have different data types like weapon, armor, and pet. Each of them has their own specific fields, but also shares some common fields like id, statistic, createdAt, updatedAt, etc.

I'd like to extract these common fields into a shared form component. I'm currently trying to write a component that accepts the form object as a prop, but the FormApi type is really hard to write due to the large number of generic parameters.

Do you have any suggestions on how to handle this pattern more cleanly? Especially around typing the form prop and making reusable field blocks?

Thanks!

dusk wind
# lucid rampart Hi everyone, I'm using TanStack Form with SolidJS, and I'm trying to extract som...

Form composition is currently in the works for Solidjs. Follow it here https://github.com/TanStack/form/pull/1453

Solid users are few and far between, so any feedback / criticism is greatly appreciated!

GitHub

TODOs

Write docs
Receive code review from community to validate if useFieldContext should return a signal or stay as-is

#

especially for the signal in useFieldContext

#

as for field blocks, that is currently being tracked in a different PR which is React only at the moment. However, if the linked PR gets merged and feedback is collected, it can then be used to implement the field groups

cerulean flint
# lucid rampart OK, thank you very much

Hey

I did some work on another PR and got it working.
You can try it out by installing my PR, feedback is welcome.

npm i https://pkg.pr.new/@tanstack/solid-form@1597