ant-design/components/radio/radio.jsx

25 lines
668 B
React
Raw Normal View History

import RcRadio from 'rc-radio';
2015-08-21 18:24:09 +08:00
import React from 'react';
2016-01-21 22:45:21 +08:00
import classNames from 'classnames';
2015-08-21 18:24:09 +08:00
export default class Radio extends React.Component {
static defaultProps = {
prefixCls: 'ant-radio'
}
2015-08-21 18:24:09 +08:00
render() {
2016-03-04 12:07:17 +08:00
const { prefixCls, children, checked, disabled, className, style } = this.props;
2016-01-21 22:45:21 +08:00
const classString = classNames({
[prefixCls]: true,
[`${prefixCls}-checked`]: checked,
[`${prefixCls}-disabled`]: disabled,
2016-01-21 22:45:21 +08:00
[className]: !!className,
});
2015-08-21 18:24:09 +08:00
return (
2016-03-04 12:07:17 +08:00
<label className={classString} style={style}>
<RcRadio {...this.props} style={null} children={null} />
2016-01-21 22:45:21 +08:00
{children}
2015-08-21 18:24:09 +08:00
</label>
);
}
}