diff --git a/src/Checkbox.jsx b/src/Checkbox.jsx
index 066b35a..9058c95 100644
--- a/src/Checkbox.jsx
+++ b/src/Checkbox.jsx
@@ -88,7 +88,16 @@ export default class Checkbox extends React.Component {
onClick,
onFocus,
onBlur,
+ ...others,
} = this.props;
+
+ const globalProps = Object.keys(others).reduce((prev, key) => {
+ if (key.substr(0, 5) === 'aria-' || key.substr(0, 5) === 'data-' || key === 'role') {
+ prev[key] = others[key];
+ }
+ return prev;
+ }, {});
+
const { checked } = this.state;
const classString = classNames(prefixCls, className, {
[`${prefixCls}-checked`]: checked,
@@ -109,6 +118,7 @@ export default class Checkbox extends React.Component {
onFocus={onFocus}
onBlur={onBlur}
onChange={this.handleChange}
+ {...globalProps}
/>
diff --git a/tests/index.js b/tests/index.js
index 8fb425a..8e214e6 100644
--- a/tests/index.js
+++ b/tests/index.js
@@ -41,4 +41,28 @@ describe('rc-checkbox', () => {
TestUtils.scryRenderedDOMComponentsWithTag(inst, 'input')[0].click();
expect(!!inst.state.checked).to.be(true);
});
+
+ it('passes data-* props to input', () => {
+ ReactDOM.render(, container, function init() {
+ inst = this;
+ });
+ const renderedInput = TestUtils.scryRenderedDOMComponentsWithTag(inst, 'input')[0];
+ expect(renderedInput.attributes['data-type'].value).to.equal('my-data-type');
+ });
+
+ it('passes aria-* props to input', () => {
+ ReactDOM.render(, container, function init() {
+ inst = this;
+ });
+ const renderedInput = TestUtils.scryRenderedDOMComponentsWithTag(inst, 'input')[0];
+ expect(renderedInput.attributes['aria-label'].value).to.equal('my-aria-label');
+ });
+
+ it('passes role prop to input', () => {
+ ReactDOM.render(, container, function init() {
+ inst = this;
+ });
+ const renderedInput = TestUtils.scryRenderedDOMComponentsWithTag(inst, 'input')[0];
+ expect(renderedInput.attributes.role.value).to.equal('my-role');
+ });
});