npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

Iโ€™ve always been into building performant and accessible sites, but lately Iโ€™ve been taking it extremely seriously. So much so that Iโ€™ve been building a tool to help me optimize and monitor the sites that I build to make sure that Iโ€™m making an attempt to offer the best experience to those who visit them. If youโ€™re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, ๐Ÿ‘‹, Iโ€™m Ryan Hefnerย  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If youโ€™re interested in other things Iโ€™m working on, follow me on Twitter or check out the open source projects Iโ€™ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soonโ€“ish.

Open Software & Tools

This site wouldnโ€™t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you ๐Ÿ™

ยฉ 2026 โ€“ย Pkg Stats / Ryan Hefner

@otitoju/formcraft-core

v1.0.0

Published

๐Ÿš€ Lightweight, TypeScript-first form management library for React and React Native with built-in validation, zero dependencies, and excellent developer experience

Readme

@otitoju/formcraft-core

๐Ÿš€ Lightweight, TypeScript-first form management library for React and React Native

npm version Downloads Bundle Size TypeScript License: MIT

โœจ Why FormCraft?

  • ๐Ÿชถ Ultra Lightweight - Only ~5KB gzipped, zero dependencies
  • ๐Ÿ”ง TypeScript First - Full type safety with excellent IntelliSense
  • ๐ŸŒ Cross Platform - Works seamlessly with React and React Native
  • โšก Performance Focused - Optimized re-renders and efficient updates
  • ๐ŸŽฏ Developer Experience - Simple API inspired by React Hook Form
  • โœ… Built-in Validation - Zod-inspired schema validation included
  • ๐Ÿ“ฑ Mobile Ready - Native components for React Native
  • โ™ฟ Accessible - WCAG compliant with proper ARIA attributes

๐Ÿš€ Quick Start

```bash npm install @otitoju/formcraft-core

or

yarn add @otitoju/formcraft-core

or

pnpm add @otitoju/formcraft-core ```

React/Next.js Example

```tsx import { useForm, WebFormProvider, WebInput, Schema } from '@otitoju/formcraft-core'; import '@otitoju/formcraft-core/dist/web.css'; // Optional default styles

interface FormData { email: string; password: string; }

function LoginForm() { const form = useForm({ defaultValues: { email: '', password: '' }, validation: { email: Schema.email().required('Email is required'), password: Schema.string().min(8, 'At least 8 characters').required() } });

const onSubmit = (data: FormData) => { console.log('Form submitted:', data); };

return ( Sign In ); } ```

React Native Example

```tsx import { useForm, NativeFormProvider, NativeInput, Schema } from '@otitoju/formcraft-core'; import { View, Button } from 'react-native';

function ContactForm() { const form = useForm({ defaultValues: { name: '', email: '' }, validation: { name: Schema.string().required('Name is required'), email: Schema.email().required('Email is required') } });

return ( ); } ```

๐Ÿ“š Documentation

Core Hook

```tsx const form = useForm({ defaultValues: { name: '', email: '' }, validation: { name: Schema.string().required().min(2), email: Schema.email().required() }, mode: 'onChange' // 'onChange' | 'onBlur' | 'onSubmit' }); ```

Schema Validation

```tsx const schema = { email: Schema.email().required('Email is required'), age: Schema.number().min(18, 'Must be 18+').max(100), website: Schema.url().required(), password: Schema.string() .min(8, 'At least 8 characters') .pattern(/^(?=.[a-z])(?=.[A-Z])(?=.*\d)/, 'Must contain uppercase, lowercase, and number') .required(), terms: Schema.string().custom(value => value === true || 'You must accept the terms') }; ```

Form State

```tsx const { values, // Current form values errors, // Validation errors touched, // Fields that have been interacted with dirty, // Fields that have been modified isValid, // Overall form validity isSubmitting,// Submission state isDirty // Whether any field has been modified } = form.formState; ```

๐ŸŽฏ Comparison

| Feature | FormCraft | React Hook Form | Formik | |---------|-----------|-----------------|--------| | Bundle Size | ~5KB | ~25KB | ~45KB | | TypeScript | โœ… Built-in | โœ… Good | โš ๏ธ Basic | | React Native | โœ… Native | โŒ Manual | โŒ Manual | | Validation | โœ… Built-in | โŒ External | โŒ External | | Learning Curve | ๐ŸŸข Easy | ๐ŸŸก Medium | ๐Ÿ”ด Hard | | Performance | โšก Excellent | โšก Excellent | ๐ŸŸก Good |

๐Ÿ› ๏ธ Advanced Usage

Conditional Fields

```tsx const showDetails = form.watch('type') !== '';

return ( {showDetails && } ); ```

Custom Validation

```tsx const validation = { username: Schema.string() .required('Username is required') .custom(async (value) => { const isAvailable = await checkAvailability(value); return isAvailable || 'Username is taken'; }) }; ```

Dynamic Forms

```tsx const [fields, setFields] = useState(['field1']);

return ( {fields.map(fieldName => ( ))} <button onClick={() => setFields(prev => [...prev, field${prev.length + 1}])}> Add Field ); ```

๐ŸŽจ Styling

Web (CSS Classes)

```tsx ```

React Native (Style Objects)

```tsx <NativeInput name="email" inputStyle={{ borderColor: 'blue' }} containerStyle={{ marginBottom: 20 }} labelStyle={{ fontSize: 18 }} /> ```

๐Ÿค Migration Guides

From React Hook Form

```tsx // React Hook Form const { register, handleSubmit, formState: { errors } } = useForm();

// FormCraft const form = useForm(); const field = form.register('email'); // Same API! ```

From Formik

```tsx // Formik <Formik initialValues={{ email: '' }} onSubmit={handleSubmit}>

// FormCraft ```

๐Ÿ“ฆ What's Included

  • โœ… Core form management hook
  • โœ… Built-in validation with Schema builder
  • โœ… Web components (Input, Select, Textarea, Checkbox)
  • โœ… React Native components
  • โœ… TypeScript definitions
  • โœ… Default CSS styles
  • โœ… Comprehensive examples

๐Ÿ”— Links

๐Ÿ“„ License

MIT ยฉ Otitoju


Made with โค๏ธ for the React community

โญ Star on GitHub | ๐Ÿ“ฆ View on NPM