Checkbox
A simple boolean checkbox.
Examples
Plain Checkbox
<Checkbox
size="small|medium(default)"
checked
indeterminate
/>
With label
<Checkbox
...
label="A checkbox with a label"
meta="And some meta text"
/>
With Critical, Warning, Success, and Disabled States
<Checkbox
state="''(default)|critical|warning|success"
/>
With children
Child content only visible when checked.
Child content only visible when checked.
Child content always visible.
Child content always visible.
<Checkbox
...
alwaysShowChildren
/>
Controlled Checkbox
<Checkbox
size="small|medium(default)"
checked
indeterminate
onChange={(evt, checked) => ...}
/>
As a list
<CheckboxGroup
name="labeled"
values={['a']}
label="A list of radio choices"
helperText="Just pick one"
onChange={(evt, values) => ...}
>
<Checkbox value="a" />
<Checkbox value="b" />
<Checkbox value="c" />
</CheckboxGroup>
Props
| Name | Type | Default Value | Required | Description |
|---|---|---|---|---|
alwaysShowChildren | boolean | false | No | Should the children display even if `checked=false`? |
indeterminate | boolean | false | No | Show a partially selected checkbox when `checked=true`. |
label | ReactNode | No | A string or component to display as a label above the input | |
meta | ReactNode | No | A string or component to display as meta text beneath the input | |
onChange | FormControlChangeEventHandler<InputType, string | number | readonly string[] | (string | number | readonly string[])[]> | undefined | No | Emit a new value when the input's selected value changes. | |
size | "small" | FormControlSize | "medium" | FormControlSize.Medium | No | The size of the field |
state | "" | FormControlState | "critical" | "warning" | "success" | FormControlState.Default | No | The state of the field |
Enums
FormControlSize
| Key | Value |
|---|---|
Small | "small" |
Medium | "medium" |
FormControlState
| Key | Value |
|---|---|
Default | "" |
Critical | "critical" |
Warning | "warning" |
Success | "success" |