Sets the autocomplete
on the form.
The used CSS class overrides.
Timeout in milliseconds after which a validation should start.
The dirty fields by path as a svelte store.
This allows to show errors conditionally if the user has already visited that field.
{#if $dirty.has(email) && $errors.has(email)} $dirty.get(email).message {/if}
Which events should mark a field as dirty.
The form errors keyed by field path as a svelte store.
If a validate function is provided to a field, then when it is called this map will be modified.
{#if $errors.has(email)} $errors.get(email).message {/if}
Whole form error, not associated with any field
The invalid, meaning dirty and not validating and error, fields by path as a svelte store.
{#if $invalid.has(email)} $invalid.get(email).message {/if}
Boolean that is true when pristine is false
When this becames true
the {@link ValidityCSSClasses.dirty} CSS class is added to the form.
Determines if the whole form is valid.
When this becames true
the {@link ValidityCSSClasses.valid} CSS class is added to the form.
Boolean that is true when form is pristine.
A form is pristine when it has not been touched && no values have been entered in any field.
When this becames true
the {@link ValidityCSSClasses.pristine} CSS class is added to the form.
Determins if the form has been succesfully submitted.
When this becames true
the {@link ValidityCSSClasses.submitted} CSS class is added to the form.
Determines if the form is submitting (most likely because of a submit).
When this becames true
the {@link ValidityCSSClasses.submitting} CSS class is added to the form.
Determines if the whole form is validating (most likely because of a submit).
This does not reflect individual field validation triggered by validateAt.
When this becames true
the {@link ValidityCSSClasses.validating} CSS class is added to the form.
Function that will reset the form to its initial state.
This will abort all active field validation, reset all stores and call FormupOptions.onReset.
This may have no effect (eg is ignored) if there is an active submit.
A yup like schema to perform validation.
Set the dirty state of a field imperatively.
Set the error message of a field imperatively.
Set the form error manually.
If error
is falsey means deleting the path from the store.
Set the validating state of a field imperatively.
A top-level status object that you can use to represent form state that can't otherwise be expressed/stored with other methods.
This is useful for capturing and passing through API responses to your inner component.
This function will submit the form and trigger some lifecycle events.
Number of times the form was submitted.
Resetted to zero after a succesful FormupContext.submit or a FormupContext.reset.
The valid, meaning dirty and not validating and no error, fields by path as a svelte store.
A svelte action to validate the element and all its form children it is applied to.
<script>
import { formup } from 'svelte-formup'
const { validate } = formup(options)
</script>
<form use:validate>
<!-- .... --->
<input use:validate={{ on: 'input' }}>
<!-- .... --->
</form>
Imperatively call field's validate function if specified for given field.
Which events should trigger a validation.
The currently validating fields by path as a svelte store.
This allows to show a spinner if a field is validated.
{#if $validating.has(email)}<Spinner />{/if}
A svelte action to update the validity state of the element and all its form children it is applied to.
That means updating setCustomValidity
, aria-invalid
and the ValidityCSSClasses.
<script>
import { formup } from 'svelte-formup'
const { validate, validity } = formup(options)
</script>
<form use:validate>
<fieldset use:validity>
<!-- .... --->
</fieldset>
</form>
The form values as a svelte store.
<input id="email" bind:value="{$values.email}" />
Generated using TypeDoc
Provides to all form properties.