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

feform

v0.1.17

Published

Simple Reactive Form Components

Downloads

31

Readme

feform (Iron-Form)

Simple Reactive Forms

Requirements

  • NPM
  • React 15.2+

Installation

Available through NPM: npm install --save feform

Import directly into your project: import Form from 'feform';

Usage

Creating a Basic Input

Create custom inputs for your project by wrapping any React component with an feinput:

import {feinput} from 'feform';

const Field = feinput(({label, setValue, value, type = 'text', ...rest}) => {
    const onChange = function(event) {
        setValue(event.target.value);
    };

    return (
        <fieldset>
            <label>{label}</label>
            <input type={type} onChange={onChange} value={value}/>
        </fieldset>
    );
});

All components decorated with feinput receive the following props:

  • value (string)
  • setValue (fn)
  • clearValue (fn)
  • resetValue (fn)
  • errors (Array)
  • pristine (bool)

setValue must be invoked the set the value of your inpur within your <Form> component.

Creating a Basic Form

import Form from {feform};

const BasicForm = (props) => {
    return (
        <div>
            <h2>Basic Form</h2>
            <Form submit={event => console.log(event)}>
                <Field name="username" label="Username"/>
                <Field name="password" label="Password" type="password"/>
                <button type="submit">Submit</button>
                <button type="reset">Reset</button>
            </Form>
        </div>
    );
};

<Form> components support passing the following props:

  • submit (fn) - invoked upon submission
  • afterReset (fn) - invoked after all inputs are reset
  • validityChange (fn) - invoked every time an feinput's setValue method is called

Additionally, the following methods are available on a <Form> component:

  • reset() - used to externally reset the <Form>
  • submit() - used to externally submit the <Form>
  • runValidations() - used to manually force a validation check, ultimately invoking props.validityChange if defined

Adding Validations

The underlying validation engine behind Iron-Form uses validate.js. See their docs for detailed examples.

Validations are passed to Input components like so:

const BasicForm = (props) => {
    return (
        <div>
            <h2>Basic Form</h2>
            <Form submit={event => console.log(event)}>
                <Field name="username" 
                        label="Username" 
                        validations={[
                            {presence: true},
                            {email: true}
                        ]}/>
                <Field name="password" 
                        label="Password" 
                        type="password"
                        validations: {[
                            {presence: true},
                            {length: {min: 10}}
                        ]}/>
                <button type="submit">Submit</button>
                <button type="reset">Reset</button>
            </Form>
        </div>
    );
};

Validations run and are reported 1. whenever a form is submitted and 2. whenever setValue on an Input component is invoked.

Default/Initial Values

Initial or default values can be set easily by passing the initialValue prop on any feinput:

const LocationForm = (props) => {
    return (
        <div>
            <h2>Zip Code Form</h2>
            <Form submit={event => console.log(event)}>
                <Field name="zip" 
                        label="Zip Code" 
                        initialValue="90210"
                        validations={[
                            {presence: true},
                            {length: {is: 5},
                            {numericality: {onlyInteger: true}}
                        ]}/>
                <button type="submit">Find me</button>
            </Form>
        </div>
    );
};

Internally an feinput converts the initialValue to value prior to the first render cycle. initialValue is not recommended to be used within your input.