final-form-set-field-touched
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/final-form-set-field-touched package

1.0.1 • Public • Published

🏁 Final Form Set Field Touched

NPM Version NPM Downloads Build Status codecov.io styled with prettier

Mutator for setting a field as "touched" in 🏁 Final Form.


Installation

npm install --save final-form-set-field-touched

or

yarn add final-form-set-field-touched

Usage

import { createForm } from 'final-form'
import setFieldTouched from 'final-form-set-field-touched'
 
// Create Form
const form = createForm({
  mutators: { setFieldTouched },
  onSubmit
})
 
form.mutators.setFieldTouched('firstName', true)
 
form.registerField(
  'firstName',
  fieldState => {
    const { touched } = fieldState // true
  },
  {
    // ...other subscription items
    touched: true
  }
)

Mutator

form.mutators.setFieldTouched(name: string, touched: boolean) => void

Sets the specified field's touched flag to the boolean value provided.

Readme

Keywords

none

Package Sidebar

Install

npm i final-form-set-field-touched

Weekly Downloads

10,319

Version

1.0.1

License

MIT

Unpacked Size

7.82 kB

Total Files

10

Last publish

Collaborators

  • erikras