This is question is primarily directed at @hecrj but anyone else who has insight, please feel free to chime in.
Would you mind helping me understand the recommended way to extend
composable-forms? I want to write custom view code (I’m using Bulma.io for css components) and want to be able to add a date-picker field type. I started creating a
Form.View.CustomConfig msg element but then noticed the note at the top of docs for the
Form.View module, which says:
Note: If you are implementing your own custom fields using Form.Base then you cannot use this module. You should use Form.Base.fill to write custom view code. Take a look at the source code of this module for inspiration.
Do I basically have to reimplement the
Form.View modules using my own custom
Field type using
Form.Base? It seems like there should be an easier way to extend this library with an additional field type and to use my own view code. Am I missing something or is this the recommended path for what I’m trying to do?
Yes, you are right.
Form.View are meant to be introductory modules that can be used to satisfy simple use cases.
Once you are familiar with the library, I recommend developing your own
Form.View modules so you can satisfy any special needs that you may have now and in the future without being tied to a particular set of fields or a specific rendering strategy. This is why every field has its own module and should be easily reusable.
Yes, this would be ideal.
As I have mentioned on Slack a couple of times, I think a
Form.Advanced module with a
customField type variable could work. However, I am not sure if we should encourage users to use such a solution, as it can potentially force them to implement “empty views” for fields that they may not really need.
I also think a
Form.View.Advanced module to help users build their own custom renderer is an approach that is worth exploring.
I have not had the time yet to experiment with these approaches, but I am always glad to receive contributions and suggestions. Any efforts toward this goal will be greatly appreciated.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.