🔧 Framework-agnostic form validation engine - TypeScript schema validation core
The foundational validation logic that powers the entire el-form ecosystem.
Package | Use When | Bundle Size | Dependencies |
---|---|---|---|
el-form-react-hooks | You want full control over UI/styling | 11KB | None |
el-form-react-components | You want pre-built components with Tailwind | 18KB | Tailwind CSS |
el-form-react | You want both hooks + components | 29KB | Tailwind CSS |
el-form-core | Framework-agnostic validation only ← You are here | 4KB | None |
⚠️ For React users: You probably want one of the React packages above instead of this core package.
npm install el-form-core zod
This package contains the framework-agnostic validation logic and utilities that power El Form. It's designed to be used as a foundation for building form libraries for different frameworks.
- 4KB bundle size - Ultra-lightweight core
- Framework agnostic - Works with any JavaScript framework
- Zod-powered - Type-safe validation
- Pure functions - Functional validation utilities
This is the foundation of the el-form ecosystem:
-
el-form-core
- Framework-agnostic validation logic (4KB) ← You are here -
el-form-react-hooks
- React hooks only (11KB) -
el-form-react-components
- Pre-built UI components (18KB) -
el-form-react
- Everything combined (29KB)
If you're building a React application, you should use one of these instead:
npm install el-form-react-hooks
npm install el-form-react-components
npm install el-form-react
import { validateForm } from "el-form-core";
import { z } from "zod";
const schema = z.object({
name: z.string().min(1, "Name is required"),
email: z.string().email("Invalid email"),
});
const formData = {
name: "John Doe",
email: "john@example.com",
};
const result = validateForm(schema, formData);
if (result.success) {
console.log("Valid data:", result.data);
} else {
console.log("Validation errors:", result.errors);
}
-
Parameters:
-
schema
- Zod schema for validation -
data
- Form data to validate
-
-
Returns: Validation result with
success
,data
, anderrors
-
Parameters:
schema
- Zod schema - Returns: Validation utilities for the schema
npm install el-form-react-hooks
import { useForm } from "el-form-react-hooks";
// Build any UI you want with full control
npm install el-form-react-components
import { AutoForm } from "el-form-react-components";
// Zero-boilerplate forms from schemas
npm install el-form-react
import { useForm, AutoForm } from "el-form-react";
// Both hooks and components
MIT