UNPKG

@navinc/base-react-components

Version:
26 lines (20 loc) 945 B
All form-element components expect to be controlled components. This makes them immediately compatible with form managers like formik or redux-form, as well as within any stateful component. Use the `<CurrencyInput />` component just as you would for any `input` type that accepts textual input (`radio`, `checkbox` have their own respective components). All props get passed on to the underlying `input`. In addition to native form element attributes, all form-element components implement these props isInvalid: Boolean -- Indicates whether the value of the field is valid (`false`) or invalid (`true`) ``` <CurrencyInput name="my-input" required isInvalid={this.state['my-input'].isInvalid} onChange={this.handleChange} // `value` and `formattedValue` are available in `values` obj, can use like : const {value, formattedValue} = values value={this.state['my-input'].value} /> ``` TODO: Add some standardized onClick tracking?