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

ornament-form-kit

v2.1.0

Published

React Form Components

Downloads

166

Readme

React Form Kit Build Status

Install

npm install ornament-form-kit

You also need to install peer dependencies by yourself

npm install lodash // v4.x.x
npm install react // v16.x.x
npm install prop-types // v15.x.x

This module targets Node.js 8 or later and the latest version of Chrome, Firefox, and Safari. If you want support for older browsers use Babel compiler.

Usage

Include:

const { Form, Text } = require('ornament-form-kit');
const Form = require('ornament-form-kit/form');
const Text = require('ornament-form-kit/text');

Full example:

const {
  Form,
  Submit,

  Text,
  Textarea,
  Select,
  RadioGroup,
  Checkbox,
} = require('ornament-form-kit');


// Validation scheme
const personValidation = {
  firstname: {
    required: true,
    validate: [value => value.length > 5],
    message: 'Wrong name format',
  },

  sex: {
    required: true,
    message: 'Sex is required',
  },
};

const App = () => (
  <Form
    {/* Pre-fills form with default data */}
    defaultModel={personModel}

    {/* Validation scheme */}
    validation={personValidation}

    {/* Enable real time validation */}
    validateOnUpdate

    {/* Override real time validation rate limit, default: 200 */}
    validationRate={500}

    {/* Native event, takes event as argument */}
    onSubmit={handleSubmit}

    {/* Validation was passed, takes model as argument */}
    onValidSubmit={handleValidSubmit}

    {/* Validation wasn't passed */}
    onInvalidSubmit={handleInvalidSubmit}
  >
    {/* field is model key */}
    <Text field="firstname" />
    <Textarea field="description" />
    <Checkbox field="married" />

    {/* options: array of { value, content } objects */}
    <Select field="gender" options={options} />
    <RadioGroup field="age" options={options} />
  </Form>
);

Components

Form

const Form = require('ornament-form-kit/form');
  • Main component. It stores model and updates it.
  • Every control should be placed inside it.
  • If form is locked then all children controls are locked.

Properties:

  • locked: boolean Locks form submit and model update
  • defaultModel: object Object to pre-fill form
  • validateOnUpdate: bool Enable/Disable real time validation
  • validationRate: number Real time validation rate limit
  • validation: object Validation scheme
  • children: function node If function is passed then it takes form api as an argument. More about form api in "form connect" section
  • onSubmit: function Native form submit event. Takes native event as argument
  • onValidSubmit: function Called when validation was passed. Takes model as argument
  • onInvalidSubmit: function Called when validation wasn't passed

Text

const Text = require('ornament-form-kit/text');

Properties:

  • field: string Model field name
  • type: string Input "type" attribute

Textarea

const Textarea = require('ornament-form-kit/textarea');

Properties:

  • field: string Model field name

Select

const Select = require('ornament-form-kit/select');

Properties:

  • field: string Model field name
  • options: array Array of { value, content } objects

Checkbox

const Checkbox = require('ornament-form-kit/checkbox');

Properties:

  • field: string Model field name

RadioGroup

const RadioGroup = require('ornament-form-kit/radio_group');

Properties:

  • field: string Model field name
  • options: array Array of { value, content } objects
  • itemClassName: string Each <input type="radio"> is wrapped in span. You can pass css class name for it
  • contentClassName: string Each radio content is wrapped in span. You can pass css class name for it

Submit

const Submit = require('ornament-form-kit/submit');

Disabled if parent form is locked

Form connect HOC

const connect = require('ornament-form-kit/connect');

It is possible to write own controls and components. By wrapping component by connect form api is passed as extra prop.

Example

const connect = require('ornament-form-kit/connect');


const MyComponent = connect(({ form }) => {
  // ... do smth with form api
});

Form api

  • locked: bool Is form locked or not
  • model: object Form model
  • errors: object Errors object. Each key corresponds to model field and contains error messages that was passed to validation
  • updateField: function Takes 2 params - field name and new value

License

MIT © Abylay Keldibek