Thank you for you feedback, @andys8!
composable-form is not really meant to help you render forms. In the end, I think that everyone has different needs when it comes to form rendering, so trying to come up with an abstraction for that is very hard.
The provided Form.View.asHtml renderer produces a very simple HTML structure with some hardcoded classes. It is meant to be a basic default for simple use cases and to try out the API.
You have 2 different options to create a custom renderer:
- Use
Form.View.custom to write a renderer that outputs Html.Styled.Html using elm-css.
- Write your own renderer from scratch using
Form.fill.
With (1) you will define a set of functions that render each type of field using elm-css and you will get a renderer that can be used like Form.View.asHtml.
With (2) you are entirely free to implement your renderer without depending on the Form.View API (i.e., no need to use Form.View.Model, etc.).
I do not think there is a way to create a default form renderer that is abstract enough to keep everyone happy.
So, the idea right now is to keep Form.View.asHtml simple and encourage people to write their own custom renderer when they have special needs. In the end, a renderer is just view code that you would have written if you were not using composable-form anyways. The difference is that composable-form forces you to make the form view code reusable, so you only need to write it once to render all your forms!