Fork me on GitHub

I vaguely remember talk at ClojuTRE about generating forms / UI based on Malli. Has anyone tried something like that? Any interesting pointers?


Yea that is something I am highly interested in finding out


generating UIs - there are many ways to do that: 1. walk the malli schema and emit an ui-application out of that, did a quick hack of that in a project, reagent + antd 2. walk the malli schema and emit an ui-schema out of that, to be rendered somehow 3. have both malli schema (“the model”) and an ui-schema (“the layout”) and use them together to generate the ui

👍 8
👀 4

in 1 & 2, the malli.visitor needs 1-2 extra args to be usefull: all walked schemas should know their place in the schema (e.g. the :in in explain) and in the data (the :path). This enables the ui-elements to be standalone, the ui-component knows where in the app-state the data needs to be stored.


I used formik-style custom helper to get the usability-stuff done right, dirty form state etc.


but, nothing Ready now, if someone has time and skills at making awesome forms, happy to help with that.


there is, idea was that it’s own model could be swapped with malli (just need a protocol to abstract the model and make malli-domino wrapper). It has also a graph-engine to calculate values & other cool features.


checked the js-side form generators last year, some good things to learn from there, e.g. &


in my ad-hoc generator, had ui-hints as properties like this: [:and {:ui/label "arvostelu", :ui/type :rate} int?]