I'm learning Material UI
and I'm trying to display an checkbox with a label. Following the samples in the online docs, I'm rendering a checkbox, but no label. What am I doing wrong?
return (
<div className="entryForm" >
<div style={{width:'100%'}}>
<h3 style={ {display:'inline-block' } }>
User Details
</h3>
<span style={{float:'right'}}>
<Checkbox
label="Active"
labelPosition="left"
/>
</span>
</div>...
I think it depends on the MUI version you are using. If you're using version 1.0 and above you should use FormControlLabel:
import {FormControlLabel} from 'material-ui/Form';
<FormControlLabel
control={
<Checkbox
name="SomeName"
value="SomeValue"
/>
}
label="MyLabel"/>
More in the documentation: https://material-ui-next.com/demos/selection-controls/
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments