ant-design/components/form/Form.jsx

34 lines
747 B
React
Raw Normal View History

2015-10-09 13:53:04 +08:00
import React from 'react';
import classNames from 'classnames';
2015-10-09 13:53:04 +08:00
class Form extends React.Component {
render() {
const { prefixCls, className } = this.props;
const formClassName = classNames({
[className]: !!className,
2015-10-09 13:53:04 +08:00
[`${prefixCls}-horizontal`]: this.props.horizontal,
[`${prefixCls}-inline`]: this.props.inline,
});
2015-10-09 13:53:04 +08:00
return (
<form {...this.props} className={formClassName}>
2015-10-09 13:53:04 +08:00
{this.props.children}
</form>
);
}
}
Form.propTypes = {
prefixCls: React.PropTypes.string,
horizontal: React.PropTypes.bool,
inline: React.PropTypes.bool,
children: React.PropTypes.any,
onSubmit: React.PropTypes.func,
};
Form.defaultProps = {
prefixCls: 'ant-form',
};
module.exports = Form;