Skip to content

Instantly share code, notes, and snippets.

@dtinth
Created February 22, 2016 12:39
Show Gist options
  • Save dtinth/9331d90aaace9aaed53d to your computer and use it in GitHub Desktop.
Save dtinth/9331d90aaace9aaed53d to your computer and use it in GitHub Desktop.
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