@uptimeventures/ufs

Core form management utilities for React.

Stats

StarsIssuesVersionUpdatedCreatedSize
@uptimeventures/ufs
0.4.14 years ago4 years agoMinified + gzip package size for @uptimeventures/ufs in KB

Readme

ufs

Elegant, lightweight form validation and processing for React and React Native.

Installation

UFS is a two-part system. You'll need this module, plus a visual adapter layer. You're welcome to build your own, but we've provided a few handy components via the @uptimeventures/ufs-dom package.

First, run npm install @uptimeventures/ufs. Then, add the component layer of your choice. Here, we'll use ufs-dom:

import React from 'react'
import Form from '@uptimeventures/ufs'
import { Input } from '@uptimeventures/ufs-dom'

const App = () => (
  <Form
    handleSubmit={handleSubmit}
    validate={validate}
  >
    {({ handleSubmit }) => (
      <Input
        label="Name"
        name="name"
        required
      />
      <Input
        label="Email Address"
        name="email"
        type="email"
        required
      />
      <button> {/* Available since we're rendering on DOM */}
        Submit
      </button>
    )}
  </Form>
)

const validate = ({ name, email }) => ({
  name: !name ? 'Please provide your name.' : undefined,
  email: !email ? 'Please provide your email.' : undefined,
})

const handleSubmit = values => {}

For more details, including information on other visual integration layers, visit the GitHub page.

License

Copyright 2018 Uptime Ventures, Ltd. All rights reserved. Released under the 3-Clause BSD License.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.