github repository for svelte forms lib

Observables

createForm exposes a number of observable values which allows us to observe the state of the form and perform UI logic depending on if the form is validating, submitting or has an error.

The complete list of observables are:

  • form
  • state
  • touched
  • errors
  • isValid
  • isValidating
  • isSubmitting

NOTE: Since they're observables you'll need to either subscribe or use the the $ prefix in the template to auto-subscribe and access their values e.g.

  • form = $form
  • state = $state
  • touched = $touched
  • errors = $errors
  • isValid = $isValid
  • isValidating = $isValidating
  • isSubmitting = $isSubmitting

See the official Svelte docs for more on auto subscribing or check out the example below.

code

 
copy