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

@earthling-ui/forms

v1.0.0-alpha.2

Published

**@earthling-ui/forms** is a lightweight package for managing form state and validation in React applications. It provides a simple and flexible way to manage form data and interact with form fields, enabling you to build responsive and dynamic forms effo

Readme

@earthling-ui/forms

@earthling-ui/forms is a lightweight package for managing form state and validation in React applications. It provides a simple and flexible way to manage form data and interact with form fields, enabling you to build responsive and dynamic forms effortlessly. This package is built on top of Zustand, a state management library for React.

Installation

You can easily install this package from NPM using npm or yarn:

npm install @earthling-ui/forms
# or
yarn add @earthling-ui/forms
# or
pnpm install @earthling-ui/forms
# or
bun install @earthling-ui/forms

Usage

Here is a brief overview of how to use this package:

  1. Import the necessary functions:
import { useForm } from "@earthling-ui/forms";
  1. Create a form store using the useForm hook:
const form = useForm({
  defaultValues: {
    // Define your form fields and their initial values here
    field1: "initialValue1",
    field2: "initialValue2",
  },
  onSubmit: async (data) => {
    // Handle form submission, e.g., send data to a server
  },
  onError: (error) => {
    // Handle form submission errors
  },
});
  1. Access form data and methods:

You can access various properties and methods provided by the form:

  • form.data: This is the form state object.

  • form.submit(): Trigger the form submission. It will call the onSubmit function provided during initialization.

  • form.reset(): Reset the form to its initial values.

  • form.useFormField(key): Create a custom hook to access, set, and validate a specific form field.

Example:

const [fieldValue, setFieldValue, fieldErrors] = form.useFormField("field1");
  1. Use the form state and methods:

You can now use the form state and methods in your React components to build your form UI.

<form action={form.submit}>
  <input
    type="text"
    value={fieldValue}
    onChange={(e) => setFieldValue(e.target.value)}
  />
  {fieldErrors && <div>{fieldErrors.message}</div>}
  <button type="submit">Submit</button>
</form>

Example

Here's a simple example of a login form using @earthling-ui/forms:

import React from "react";
import { useForm } from "@earthling-ui/forms";

const LoginForm = () => {
  const form = useForm({
    defaultValues: {
      email: "",
      password: "",
    },
    onSubmit: async (data) => {
      // Submit the form data to your server
    },
  });

  const [email, setEmail, emailErrors] = form.useFormField("email");
  const [password, setPassword, passwordErrors] = form.useFormField("password");

  return (
    <form action={form.submit}>
      <label>Email:</label>
      <input
        type="text"
        value={email}
        onChange={(e) => setEmail(e.target.value)}
      />
      {emailErrors && <div>{emailErrors.message}</div>}

      <label>Password:</label>
      <input
        type="password"
        value={password}
        onChange={(e) => setPassword(e.target.value)}
      />
      {passwordErrors && <div>{passwordErrors.message}</div>}

      <button type="submit">Submit</button>
    </form>
  );
};

export default LoginForm;

License

This package is open-source and distributed under the MIT License. Feel free to use and modify it according to your needs.

Issues and Contributions

If you encounter any issues or have suggestions for improvements, please report them on GitHub.

If you'd like to contribute to the development of this package, feel free to submit pull requests.

Credits

This package is developed by Steven Frady.

Enjoy using @earthling-ui/forms to simplify form management in your React applications! If you find it helpful, please consider giving it a star on GitHub and sharing it with others.