forked from muicss/mui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckbox.jsx
More file actions
66 lines (54 loc) · 1.29 KB
/
checkbox.jsx
File metadata and controls
66 lines (54 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
* MUI React checkbox module
* @module react/checkbox
*/
'use strict';
import React from 'react';
import * as util from '../js/lib/util';
import { controlledMessage } from './_helpers';
import { getReactProps } from './_helpers';
const PropTypes = React.PropTypes;
/**
* Checkbox constructor
* @class
*/
class Checkbox extends React.Component {
static propTypes = {
label: PropTypes.string
};
static defaultProps = {
className: '',
label: null
};
render() {
const { children, className, label, autoFocus, checked, defaultChecked,
defaultValue, disabled, form, name, required, value, onChange,
...reactProps } = this.props;
return (
<div
{ ...reactProps }
className={'mui-checkbox ' + className}
>
<label>
<input
ref="inputEl"
type="checkbox"
autoFocus={autoFocus}
checked={checked}
defaultChecked={defaultChecked}
defaultValue={defaultValue}
disabled={disabled}
form={form}
name={name}
required={required}
value={value}
onChange={onChange}
/>
{label}
</label>
</div>
);
}
}
/** Define module API */
export default Checkbox;