An open API service indexing awesome lists of open source software.

https://github.com/ctrlplusb/vue-zod-form

A composition based API forms helper for Vue 3 projects that utilise TypeScript.
https://github.com/ctrlplusb/vue-zod-form

Last synced: 9 months ago
JSON representation

A composition based API forms helper for Vue 3 projects that utilise TypeScript.

Awesome Lists containing this project

README

          

> WIP

# vue-zod-form

A composition based API forms helper for Vue 3 projects that utilise TypeScript.

```vue

import * as z from "zod";
import { useZodForm } from "vue-zod-form";

const formSchema = z.object({
name: z.string().nonempty(),
email: z.string().nonempty().email(),
password: z.string().nonempty().min(8),
});

const { field, handleSubmit, isSubmitting } = useZodForm(formSchema);

const name = field("name");
const email = field("email");
const password = field("password");

const onSubmit = handleSubmit(async (data) => {
await new Promise((resolve) => setTimeout(resolve, 2000));
alert(JSON.stringify(data, null, 2));
});




Submit

```