Created
February 22, 2016 12:39
-
-
Save dtinth/9331d90aaace9aaed53d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function Checkbox (props) { | |
return <div style={{ margin: '8px 16px' }}> | |
<MaterialCheckbox | |
label={props.label} | |
checked={props.checked} | |
onCheck={e => { | |
props.onPropChange('checked', !props.checked) | |
if (props.onchange) props.onchange(e) | |
}} | |
disabled={props.disabled} | |
/> | |
</div> | |
} | |
Checkbox.metadata = { | |
properties: propertySet({ | |
label: prop => (prop | |
.string() | |
.defaultsToName() | |
.doc('The text to display on the checkbox') | |
.input('text') | |
), | |
checked: prop => (prop | |
.boolean() | |
.doc('True if this checkbox is checked') | |
.input('checkbox') | |
), | |
disabled: preset.disabled, | |
onchange: prop => (prop | |
.callback('after the checkbox has been toggled') | |
) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment