use-vest
v0.2.5
Published
[](https://github.com/enyo/use-vest/actions/workflows/ci.yml) [](https://badge.fury.io/js/use-vest) .
To see how you would incorporate use-vest
in your form, look at the
Form.svelte file.
NOTE: Instead of posting all code snippets directly in this README, I decided to use an
example/
directory and link to it. This way the example can be type checked, and is actually the source for the unit tests so there is no risk of the documentation being outdated.
As you can see, useVest
returns a few stores that hold information about the
current state of your form.
But how do the individual input fields get their validation status?
useVest
sets up a Svelte context
(that is accessible to all children) where everything necessary to display the
input field state is stored.
Any input field inside the form simply uses getVestContext()
to get the
correct context object, and this object will contain the validation result, as
well as information about the form in general.
To see how you can use that context, look at Input.svelte and InputError.svelte.