@faivform/yup
v1.0.1
Published
Adapter to use Yup with @tuentyfaiv/svelte-form
Downloads
4
Maintainers
Readme
Faivform zod adapter
This package provides a yup adapter for faivform
You can check the documentation for more information.
Installation
npm install @faivform/yup
Basic example
<script lang="ts">
import { Field } from "@tuentyfaiv/svelte-form";
import { adapter } from "@faivform/yup";
import { signinSchema } from "./your-schema/path";
const form = faivform({ fields: adapter(signinSchema) });
const { submit } = $form;
// or
$: form = faivform({ fields: adapter(signinSchema) });
$: ({ submit } = $form);
const onSubmit = submit(async (values) => {
// your logic
});
</script>
<form on:submit|preventDefault={onSubmit}>
<Field name="email" type="email" label="Email" />
<Field name="password" type="password" label="Password" />
// ... other inputs
<button type="submit">Submit</button>
</form>