React Formly
JSON powered forms for react.
Example Usage
// add custom field typesFormlyConfigfields; var App = React; React;
Formly
API
onFormlyUpdate
Called with the model
anytime there's an update.
model
The model to represent with the form.
config
An object to configure formly. It is expected to have a name
(string, optional) and fields
(array of field
). fields
are expected to have a key
, type
/ component
, hidden
(bool/func), data
, (object), and props
(object/func)
FormlyConfig
addType
FormlyConfig;FormlyConfig;FormlyConfig;
getTypes
var FieldType = ;FormlyConfig;FormlyConfigfield1 === FieldType; // <-- true
clearTypes
var FieldType = ;FormlyConfig;var oldTypes = FormlyConfig;oldTypesfield1 === FieldType; // <-- trueFormlyConfigfield1 === undefined; // <-- trueFormlyConfig; // <-- {}
FieldMixin
Gives you 2 methods onChange
and updateValue
. onChange
invokes updateValue
with the current value. Handles special cases for checkbox
, radio
, and select
. Defaults to node.value
(input default). If your component has a transformUpdate
, then it will be called with the value and the value will be reset to whatever is returned before it calls up to its parent (presumably the Formly component) with the new value.
Contributing
Yes, please...
Just run npm install
then run gulp
to see a list of available tasks.
Credits
Based on the simple api from angular-formly
License
MIT