0.0.23 • Published 2 years ago

@svelte-parts/form-builder v0.0.23

Weekly downloads
3
License
MIT
Repository
github
Last release
2 years ago

@svelte-parts/form-builder

UI to create form descriptions for @svelte-parts/form.

Try it out in the svelte REPL

Install

npm install @svelte-parts/form-builder

Usage

<script>
  import FormBuilder from '@svelte-parts/form-builder'
</script>

<FormBuilder
  onChange={d => console.log('CHANGED', d)}
  onSubmit={d => console.log('SUBMITTED', d)}
  ignoreFields={['password', 'color']}
/>

Properties

  • onChange a function taking an array of Fields triggered on every change
  • onSubmit a function taking an array of Fields triggered when the user clicks on "Create form" (the button is only shown if this function is defined)
  • ignoreFields fields that should not be proposed to the user. Depending on the context, you may not want to encourage creating a password field, for example.