mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-04 04:58:55 +08:00
d6c0aa2e1c
close #1811
25 lines
732 B
JavaScript
25 lines
732 B
JavaScript
import RcCheckbox from 'rc-checkbox';
|
|
import React from 'react';
|
|
import CheckboxGroup from './Group';
|
|
import classNames from 'classnames';
|
|
|
|
export default class Checkbox extends React.Component {
|
|
static Group = CheckboxGroup;
|
|
static defaultProps = {
|
|
prefixCls: 'ant-checkbox',
|
|
}
|
|
render() {
|
|
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} />
|
|
{children !== undefined ? <span>{children}</span> : null}
|
|
</label>
|
|
);
|
|
}
|
|
}
|