Form library that lets you handle the presentation
MIT License
Helpers for universal form control.
Notes:
Goals:
Maybe Goals:
API Ideas
<SpicyForm
@onSubmit={{this.doTheSubmit}}
@data={{this.somePojo}}
@validator={{this.yupValidator}}
as |form|>
{{#form.helpersFor 'firstName' as |firstName|}}
{{#if firstName.hasError}}
{{firstName.error}}
{{/if}}
<label for={{firstName.fieldId}}>First name</label>
<input
id={{firstName.fieldId}}
value={{firstName.value}}
{{on 'input' firstName.onInput}}
>
{{/form.helpersFor}}
{{#form.helpersFor 'hasNotifications' as |hasNotifications|}}
<label for={{hasNotifications.fieldId}}>Enable Notifications?</label>
<input
type='checkbox'
id={{hasNotifications.fieldId}}
checked={{hasNotifications.checked}}
{{on 'change' (pipe
this.requestPermission
(hasNotifications.withChangeset (perform this.doWork))
) }}
>
{{/form.helpersFor}}
</SpicyForm>
Maybe if/when we get hash-splatting, "splashes"?:
<SpicyForm
@onSubmit={{this.doTheSubmit}}
@data={{this.somePojo}}
@validator={{this.yupValidator}}
as |form|>
{{#form.helpersFor 'firstName' as |firstName|}}
{{#if firstName.hasError}}
{{firstName.error}}
{{/if}}
<label for={{firstName.fieldId}}>First name</label>
<input ...firstName.inputAttributes>
{{/form.helpersFor}}
{{#form.helpersFor 'hasNotifications' as |hasNotifications|}}
<label for={{hasNotifications.fieldId}}>Enable Notifications?</label>
<input type='checkbox' ...hasNotifications.inputAttributes>
{{/form.helpersFor}}
</SpicyForm>
ember install ember-spicy-forms
[Longer description of how to use the addon in apps.]
See the Contributing guide for details.
This project is licensed under the MIT License.