structoform
v1.2.2
Published
React form components
Downloads
73
Readme
Structoform
A form builder for React
Installation
# yarn
yarn add structoform
# npm
npm install structoform
Supported form elements
- Checkbox
- DateField
- SelectField
- Radio Button
- TextArea
- TextField
Steps for local developement
- run
yarn link
- run
yarn prep
to build the package
Api documentation
<Form>
jsonConfig={ string }
An optional string containing a JSON parsable object. The contents of this object may override the className
, layout
, layoutDirection
or initValues
prop.
className={ string }
A className string to append to the <form>
wrapper className.
layout={ object }
An object containing all the form fields, indexed by a unique key.
const layout = {
name: {
// field props
},
organisation: {
// field props
},
email: {
// field props
},
}
layoutDirection={ string }
Determines how labels should position themselves relative to their respective form element. Specify either "row"
or "column"
.
submitButton={ node }
A react element consisting of or containing a <button>
, to trigger the form onSubmit
logic.
onSubmit={ func }
Callback function for submit logic
initValues={ object }
Values to prefill the form with
formValues={ object }
Optional external form field state, essentially utilizing the form as a controlled component.
Things todo
- [ ] Write documentation
- [ ] Add test
- [ ] Password Field
- [ ] Phone Field
- [ ] Autosuggest / Autocomplete
- [ ] Restrict input of DateField
- [ ] Support multiple languages