cl-react-form
Simple react form rendering
Examples
You can try out some of the component via react story book, still a work in progress:
yarn storybook
In the mean time the old examples can be built :
cd src/examplesyarn buildgoogle-chrome index.html
Forms
;;const config =view: 'example'lib : 'reactstrap'form:actions:submit:id: 'upload-action-submit'type: 'submit'label: 'Upload'style: 'primary'fields:id:type: 'hidden'name:label: 'Name'type: 'text'ref: 'name'value: ''placeholder: 'Name'validate:promises:rule: validationsrequired'Name required'label:value: 'foo'access:truetrueage:pristine: trueaccesss: {}checkbox:type: 'checkbox';<Formconfig=configlayout=layouterrors=errorstitle="override title (can be a function or string)"visibility=age: false // Hide the age fieldonSubmit= {} />
lib: 'react-bootstrap' | 'reactstrap'
Validations
Validations use the validate-promise library
Errors
Form errors should be an object, keyed on the field name, whose values are an array of error messages
let errors = name: 'Please enter a name' 'Cheese is not a proper name';
Lists
{const config =view: 'example'lib : 'reactstrap'list:columns:id:label: 'ID'name:label: 'Name'messages:emptyData: 'No records found'const data =id: '1' name: 'one'id: '2' name: 'two';// Hooks into various list events, this is a good place to bind your redux actionsconst listActions ={thisprops;}null // A row is selected for editingnull // A Row is selectedreturn <Listconfig=configdata=dataaccess=add: trueactions=listActions><Modal isOpen=showModal toggle=close><Formactions=close:action: closeid: 'modal-close'label: 'Close'type: 'button'data= // Initial form dataname: 'three'formUpdate=actionsformUpdatelayout="Modal"config=configonSubmit=/></Modal><List>}
Icon
Renders a font-awesome icon
;<Iconicon: stringcolor?: stringlabel?: stringpull?: stringsize?: 0 | 1 | 2 | 3 | 4 | 5stack: numberinverse: booleanspin: boolean />