dillonkearns / elm-form

Standalone version of the elm-pages Form API.
Other
19 stars 6 forks source link

Allow custom renderer #4

Open Erudition opened 1 year ago

Erudition commented 1 year ago

I would like to use web components for nicer inputs when rendering my form. From what I can tell, this package forces you to use it's own provided input element, which is locked inside Internal. I would like to use e.g. ion-input without forking the package. Perhaps others want to customize the view function as well.

dillonkearns commented 1 year ago

Hello @Erudition, I've considered this idea before as well.

Do ion-input elements follow emit the standard form events? This package has an approach that is reliant on built-in browser behaviors, including event emitters, but I believe Web Components are able to emit compatible events so that could be a way to support rendering with Custom Elements.

dillonkearns commented 1 year ago

Here's one StackOverflow discussion that touches on this a bit: https://stackoverflow.com/questions/62719004/web-components-how-to-listen-to-form-input-changes.

Erudition commented 1 year ago

Do ion-input elements follow emit the standard form events

They are prepended with ion, but the same in every other way. See here for example.

For now, I had to use custom view functions and add the events manually. Blur support is the only thing I can't add since the library has it hardwired. This causes the errors to either always or never appear (as official blur never happens).