0.5.0 • Published 10 months ago

svelte-simple-forms v0.5.0

Weekly downloads
-
License
-
Repository
github
Last release
10 months ago

Svelte Simple Forms

This is a simple package for client side form validation for svelte and sveltekit without schemas. It has simple syntax for setting up validators for your fields

Usage

import { createForm } from "svelte-simple-forms";

const form = createForm({
		email: {
			email: true,
			required: true
		},
		password: {
			required: true,
			min: 6
		},
        repassword: {
			required: true,
            equalTo: 'password'
		}
	});

	$: {
		form.validate();
	}
<form class="">
    <label>
        Email
        <input type="email" bind:value={form.email} />
            {#each form.errors.email as error}
                <p>{error}</p>
            {/each}
    </label>
    
    <label>
        Passowrd
        <input type="email" bind:value={form.password} />
            {#each form.errors.password as error}
                <p>{error}</p>
            {/each}
    </label>
    
    <label>
        RePassoword
        <input type="email" bind:value={form.repassword} />
            {#each form.errors.repassword as error}
                <p>{error}</p>
            {/each}
    </label>
</form>

You can contribute and report issues at Github.

IMAGE ALT TEXT HERE

0.5.0

10 months ago

0.4.1

10 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago