ant-design/components/checkbox/index.jsx

25 lines
718 B
React
Raw Normal View History

2015-12-24 15:03:06 +08:00
import RcCheckbox from 'rc-checkbox';
import React from 'react';
import CheckboxGroup from './Group';
2016-02-17 18:02:33 +08:00
import classNames from 'classnames';
export default class Checkbox extends React.Component {
static Group = CheckboxGroup;
static defaultProps = {
2016-05-11 09:32:33 +08:00
prefixCls: 'ant-checkbox',
}
2015-08-18 14:03:44 +08:00
render() {
2016-02-17 18:02:33 +08:00
const { prefixCls, style, children, className, ...restProps } = this.props;
const classString = classNames({
[className]: !!className,
[`${prefixCls}-wrapper`]: true,
});
return (
<label className={classString} style={style}>
<RcCheckbox {...restProps} prefixCls={prefixCls} children={null} />
2016-04-14 14:23:12 +08:00
{children ? <span>{children}</span> : null}
2016-02-17 18:02:33 +08:00
</label>
);
2015-07-15 16:01:24 +08:00
}
}