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

@ejunior95/formai-react

v0.1.1

Published

Adaptador React (Hooks) para o formAI.

Readme

@ejunior95/formai-react ⚛️

NPM Version License: MIT

Generate React form fields and validation just by describing them in plain English.

Stop wasting time searching for regex patterns, configuring mask libraries, and wiring up useState and useEffect for every single form field.

The "formAI" Gain

Building forms is boring. Let AI do the boring work for you.

⛔️ Stop Doing This...

// Manually finding regex, checking mask docs, writing state...
const [value, setValue] = useState("");
const [error, setError] = useState(null);

const PHONE_REGEX = /^\(\d{2}\)\s\d{5}-\d{4}$/;
const MASK = "(00) 00000-0000"; // Is it '0' or '9'...?

const validate = () => {
  if (!value) {
    setError("Field is required.");
  } else if (!PHONE_REGEX.test(value)) {
    setError("Invalid format.");
  }
};

return (
  <IMaskInput
    mask={MASK}
    value={value}
    onChange={(e) => setValue(e.target.value)}
    onBlur={validate}
  />
)

✨ Do This Instead!

import { useAIForm } from '@ejunior95/formai-react';
import { IMaskInput } from 'react-imask'; // You still bring your own components!

function MyPhoneField() {
  const {
    value,
    setValue,
    error,
    validate,
    loading,
    config
  } = useAIForm("A required Brazilian phone number", {
    maskPatterns: { digit: '0' } // '0' is what react-imask uses
  });

  if (loading) return <p>🤖 Generating field...</p>;

  return (
    <div>
      <label>Phone Number</label>
      <IMaskInput
        mask={config.mask} // The AI provides this!
        placeholder={config.placeholder} // And this!
        value={value}
        onAccept={(val) => setValue(val)}
        onBlur={validate} // The AI provides the validation logic!
      />
      {error && <p>{error}</p>}
    </div>
  );
}

Features

  • AI-Powered: Simply describe the field. "A 50-char max name", "An optional email", "A CPF number".

  • Headless by Design: We never render UI. useAIForm gives you the state, logic, and config. You bring your own components (ShadCN, MUI, Ant, or plain <input>).

  • Masking Made Easy: Automatically generates the correct mask string, which you just pass to your favorite mask library (like react-imask, react-text-mask, etc.).

  • Customizable: Use the maskPatterns option to tell the AI which characters your mask library uses for digits (0 vs 9) or letters (a vs A).

Installation

This package requires @ejunior95/formai-core to work.

# You must install BOTH the core engine and the react adapter
npm install @ejunior95/formai-core @ejunior95/formai-react

API

Hook Signature

useAIForm(
  prompt: string,
  options?: FormAIOptions
): UseAIFormReturn
  • prompt: The natural language description (e.g., "a 5-digit postal code").
  • options:(Optional) An optional object.
  • maskPatterns:

    • digit: The character your mask library uses for digits (e.g., '0').
    • letter: The character your mask library uses for letters (e.g., 'a').

Return Value

The hook returns an object with:

  • value: The current state of the input.
  • setValue: The setter for the input's value.
  • error: null if valid, or a string with the error message.
  • validate: A function to trigger validation (e.g., for onBlur).
  • loading: A boolean that is true while the AI is generating the config.
  • config: The raw FormAIConfig JSON object from the AI (contains mask, placeholder, regex, etc.).

Looking for other frameworks?

  • 🅰️ Angular: Coming Soon!
  • 💚 Vue: Coming Soon!