Checkbox
Basic usage
Show editable code example
Any Paragon component or export may be added to the code example.
<CheckBoxname="checkbox"label="check me out!"/>
Disabled
Show editable code example
Any Paragon component or export may be added to the code example.
<CheckBoxname="checkbox"label="you cannot check me out"disabled/>
Default checked
Show editable code example
Any Paragon component or export may be added to the code example.
<CheckBoxname="checkbox"label="(un)check me out"checked/>
Call a function
Show editable code example
Any Paragon component or export may be added to the code example.
<CheckBoxname="checkbox"label="check out the console"onChange={() => console.log('the checkbox changed state')}/>
Controlled example
Show editable code example
Any Paragon component or export may be added to the code example.
class CheckBoxWrapper extends React.Component {constructor(props) {super(props);this.toggleCheckBox = this.toggleCheckBox.bind(this);this.state = {checked: false,};}toggleCheckBox() {this.setState({checked: !this.state.checked,});}render() {return (<div className="d-flex align-items-center"><Buttonvariant="light"className="mr-3"onClick={this.toggleCheckBox}>Click me to toggle the check box!</Button><CheckBoxname="checkbox"label="click the button"checked={this.state.checked}/></div>);}}
Props API#
Check Props API
- checked
bool
Defaultfalse(
Boolean
):true
if the state should be checked,false
otherwise. This prop can be used to manage the Checkbox more directly, overriding the default Checkbox checked state. - onChange
func
Default() => {}(
Boolean
):true
if the checkbox should be disabled,false
otherwise - inputRef
func
|shape
{current:}PropTypes.element
,function to be called when the checkbox changes state
Usage Insights#
Check
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-admin-portal | 20.26.3 | 2 | |
frontend-app-authn | 20.36.2 | 3 | |
frontend-app-communications | 20.30.1 | 2 | |
frontend-app-course-authoring | 20.32.0 | 2 | |
frontend-app-discussions | 20.15.0 | 2 | |
frontend-app-learner-record | 20.32.0 | 1 | |
frontend-app-learning | 20.28.4 | 1 | |
frontend-lib-content-components | 20.34.0 | 4 | |
frontend-lib-special-exams | 20.22.4 | 1 | |
prospectus | 20.32.3 | 10 |