0.1.10 • Published 6 years ago

@xkit/formkit v0.1.10

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

formkit

npm npm Build Status codecov styled with prettier

Installation

npm install @xkit/formkit --save
yarn add @xkit/formkit

Usage

import React from 'react';
import { Form, FormControl, FormSubmit } from 'formkit';

function App() {
  function handleSubmit(values, { setSubmitting }) {
    setSubmitting(false);
  }

  return (
    <Form initialValues={{ user: { name: 'test' } }} onSubmit={handleSubmit}>
      <label>
        user.name
        <FormControl name="user.name" />
      </label>
      <FormSubmit />
    </Form>
  );
}

Multiple submit buttons

import React from 'react';
import { Form, FormControl, FormSubmit } from 'formkit';

function App() {
  function handleSubmit(values, { setSubmitting, action }) {
    console.log(action);
    setSubmitting(false);
  }

  return (
    <Form initialValues={{ user: { name: 'test' } }} onSubmit={handleSubmit}>
      <label>
        user.name
        <FormControl name="user.name" />
      </label>
      <FormSubmit action="save" />
      <FormSubmit action="submit" />
    </Form>
  );
}

Props

  • values
  • errors
  • submitting

Methods

  • getValue(name)
  • setValue(name, value)
  • getError(name)
  • setError(name, error)
  • setValues(values)
  • setErrors(errors)
  • handleChange(value, name)
  • handleFocus(name)
  • handleBlur(name)
  • handleSubmit(action)

License

MIT

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago