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 🙏

© 2025 – Pkg Stats / Ryan Hefner

reformact

v0.3.0

Published

React form component using state.

Readme

Reformact

A react form component that uses state. built with react for react with <3

Getting Started

These instructions will help you use this package, alright, let's get down to business.

installing

Run this command in a terminal to install with npm: npm i reformact -S

Usage

import reformact in your application as follows: import Form from 'reformact';

Reformact gets an array of fields and render them based on them type; for example a minimal login form would be like:

class LoginForm extends Component {
  submit = (values) => {
    const {username, password} = values //
    this.props.apiLogin(username, password)
  }
  render() {
    return (<Form fields={[
        {
          type: "text", //  html input type
          name: "username", //  unique name for input
          placeholder: "Jon doe", // placeholder
          required: true
        }, {
          type: "password",
          name: "password",
          placeholder: "****",
          required: true
        }]
     } onSubmit={(values) => this.submit(values)} submitText='Login'/>)
  }
}

this will generate a form with two inputs named username and password and a submit button as shown below.

reformact

this Form has an onSubmit attribute that gets fired when the form is submitted either with click or enter/return key and gets field values.

the submitText is the title of submit button.

Supported field types

Currently reformact supports text, number, password, textarea, select, checkbox and radio inputs, but will support lots of inputs soon.

Field attributes

The following table showing attributes. Field type * means all types field.

| Attributes | Field type | value | description | | - | - | - | - | | required | * | boolean(default=false) | check if field has a value if set true. | | requiredPhrase | * | string(default=This field is required.) | error shown when field is required and empty. | | name | * | string | a unique string in form, on submitting the form you can access a field value by values.<name> | | placeholder | * | string(default=null) | inputs placeholder. | | defaultValue | * | any(default=null) | in case of editing forms pass current values via defaultValue. | | maxLength | text, number and password | number(default=null) | maximum value length. | | maxLengthErrorPhrase | text, number and password | string(default=This field accepts <maxLength> characters.) | error shown when maxLength is crossed. | | multiSelect | select| boolean(default=false) | set true if select can have more than one values. | | selectHandle | select | component(default=an ungly css-made triangle), example: <i className="ion-ios-arrow-down (which needs ionicons) | this option is for changing the select box handle component. | | options | select, radio | array of objects with label and value | choices for select input and radio group. | | checkboxLabel| checkbox | string(default:'')| checkbox label. | | mustBeCheckedPhrase| checkbox | string(default:'This field must be checked.')| error shown when checkbox is required and not checked. |

License

This project is licensed under the MIT License.