1.0.7 • Published 10 years ago
mdl-form v1.0.7
Form for Material Design Lite
Start
- Node.js must be installed.
- Install package:
npm install mdl-form jquery react Example
You can see here.
List
Render
- Give a
jsontodata. The parameter is at here. - Give an object of components to
tags.keyis also used intagsofform.valueis component.- If you do not set a default component,
formwill set first component to default component.
Animation
- You can add an animation at render.
form-hide-animationwill hide form and rerender new form.form-hidewill be added finally.form-show-animationwill show form after form is updated.form-showwill be added finally.- noAnimation -> if you use
noAnimation={true}, this form will not render with animation.
Parameter
Title
- label
- className
- style
Submit
- label
- className
- style
- url
- click(function)
- success(function)
- 1st argument -> get data from server.
- fail(function)
- 1st argument -> data which you post to server.
Form
- This is an object for your componets in
Form. idis needed.- isNotRequire -> if you use
isNotRequire: true, this component can be empty to post to server.
How to write component
- You can see list.
- Props have three function and one data
- keyDown(function) -> this will call a click on
submit. - getData(function) -> give data to
form.- 1st argument ->
idof this component, usethis.props.data.id, normal. - 2nd argument -> give this component data to
form. - You should call it in render function and set data to empty.
- Example: this.props.getData(this.props.data.id, '')
- 1st argument ->
- getComponents(function) -> give this component to
form.- 1st argument -> id
of this component, usethis.props.data.id`, normal. - 2nd argument -> this component.
- You should call it in render function.
- Example: this.props.getComponent(this.props.data.id, this).
- 1st argument -> id
- data -> all information about component is in
this.props.data.
- keyDown(function) -> this will call a click on