Skip to content

iamkhan21/fxform

Repository files navigation

@iamkhan21/fxform NPM version

Reactive forms based on effector and zod

Usage example

import { z, ZodLiteral, type ZodNumber, type ZodString } from "zod";
import { createForm } from "@iamkhan21/fxform";


/**
 * email: ["", z.string().trim().email()] as [string, ZodString]
 * email - Name of field
 * '' - initial value
 * z.string().trim().email() - zod validation scheme
 */
const formData = {
  email: ["", z.string().trim().email()] as [string, ZodString],
  age: [null, z.number().gte(18)] as [number | null, ZodNumber],
  agreeWithRules: [false, z.literal(true)] as [boolean, ZodLiteral<true>],
};

const form = createForm(formData);

License

MIT License © 2022 Ivan Khanevich

About

Reactive forms based on effector and zod

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published