JSPM

@faivform/zod

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q35718F
  • License MIT

Adapter to use Zod with @tuentyfaiv/svelte-form

Package Exports

  • @faivform/zod
  • @faivform/zod/package.json

Readme

Faivform zod adapter

This package provides a zod adapter for faivform

You can check the documentation for more information.

Installation

npm install @faivform/zod

Basic example

<script lang="ts">
  import { Field } from "@tuentyfaiv/svelte-form";
  import { adapter } from "@faivform/zod";
  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>