Checkbox
Checkbox
Component demo
Interactive example
<ic-checkbox-grouplabel="Select your extras"name="default"><ic-checkboxvalue="extra"label="Extra shot (50p)"></ic-checkbox><ic-checkboxvalue="Soya milk"label="Soya milk"checked></ic-checkbox><ic-checkboxvalue="keep cup"label="Takeaway cup"disabled="true"></ic-checkbox></ic-checkbox-group>
<IcCheckboxGrouplabel="Select your extras"name="default"onIcChange={(ev)=>console.log("onIcChange", ev.detail.value)}><IcCheckboxvalue="extra"label="Extra shot (50p)"onIcCheck={(ev)=>console.log("onIcCheck", ev)}/><IcCheckboxvalue="Soya milk"label="Soya milk"checked/><IcCheckboxvalue="keep cup"label="Takeaway cup"disabled/></IcCheckboxGroup>
Checkbox group details
Props
All components also accept native properties supported by the DOM, such asclassName
and
style
.
|
|
|
---|---|---|
|
The label for the checkbox group to be displayed. |
|
|
The name for the checkbox group to differentiate from other groups. |
|
|
If |
|
|
The helper text that will be displayed for additional field guidance. |
|
|
If |
|
|
If |
|
|
The size of the checkboxes to be displayed. This does not affect the font size of the label. |
|
|
Sets the theme color to the dark or light theme color. "inherit" will set the color based on the system settings or ic-theme component. |
|
|
The validation status - e.g. 'error' | 'warning' | 'success'. |
|
|
The validation text - e.g. 'error' | 'warning' | 'success'. |
|
The label for the checkbox group to be displayed. |
The name for the checkbox group to differentiate from other groups. |
If |
The helper text that will be displayed for additional field guidance. |
If |
If |
The size of the checkboxes to be displayed. This does not affect the font size of the label. |
Sets the theme color to the dark or light theme color. "inherit" will set the color based on the system settings or ic-theme component. |
The validation status - e.g. 'error' | 'warning' | 'success'. |
The validation text - e.g. 'error' | 'warning' | 'success'. |
Events
All components also accept native events supported by the DOM, such as
onClick
and
onKeyDown
.
|
|
|
---|---|---|
|
|
|
|
Checkbox details
Props
All components also accept native properties supported by the DOM, such asclassName
and
style
.
|
|
|
---|---|---|
|
The label for the checkbox. |
|
|
The value for the checkbox. |
|
|
The style of additionalField that will be displayed if used. |
|
|
If |
|
|
If |
|
|
The text to be displayed when dynamic. |
|
|
The <form> element to associate the checkbox with. |
|
|
The group label for the checkbox. |
|
|
If |
|
|
If |
|
|
The name for the checkbox. If not set when used in a checkbox group, the name will be based on the group name. |
|
|
If |
|
|
The size of the checkbox to be displayed. This does not affect the font size of the label. If a checkbox is contained in a checkbox group, this will override the size set on checkbox group. |
|
|
Sets the theme color to the dark or light theme color. "inherit" will set the color based on the system settings or ic-theme component. |
|
The label for the checkbox. |
The value for the checkbox. |
The style of additionalField that will be displayed if used. |
If |
If |
The text to be displayed when dynamic. |
The <form> element to associate the checkbox with. |
The group label for the checkbox. |
If |
If |
The name for the checkbox. If not set when used in a checkbox group, the name will be based on the group name. |
If |
The size of the checkbox to be displayed. This does not affect the font size of the label. If a checkbox is contained in a checkbox group, this will override the size set on checkbox group. |
Sets the theme color to the dark or light theme color. "inherit" will set the color based on the system settings or ic-theme component. |
Slots
A slot allows for any type of element or markup to be passed into and rendered within a web component. This creates more flexibility than using a prop which must take a specific type of data.
Content can be slotted into a component by adding it as a top-level child of the component.
Slots can have a name to identify them. These specify which slot the content will be inserted into, and therefore where it will be rendered and how it will be used within the component. The name of the slot to be used can be specified by passing it via a
slot
attribute on the slotted content.
|
|
---|---|
|
|
|
Events
All components also accept native events supported by the DOM, such as
onClick
and
onKeyDown
.
|
|
|
---|---|---|
|
|
|
|
Methods
|
|
|
---|---|---|
|
|
|
|
Variants
Hidden label
Interactive example
<ic-checkbox-grouplabel="Select your extras"hide-label="true"name="1"><ic-checkboxvalue="valueName1"label="Extra shot (50p)"></ic-checkbox><ic-checkboxvalue="valueName2"label="Soya milk"checked="true"></ic-checkbox></ic-checkbox-group>
<IcCheckboxGrouplabel="Select your extras"hideLabelname="1"><IcCheckboxvalue="valueName1"label="Extra shot (50p)"/><IcCheckboxvalue="valueName2"label="Soya milk"checked/></IcCheckboxGroup>
Helper text
Interactive example
<ic-checkbox-grouplabel="Select your extras"name="1"helper-text="Additional charges may apply."><ic-checkboxvalue="valueName1"label="Extra shot (50p)"></ic-checkbox><ic-checkboxvalue="valueName2"label="Soya milk"checked="true"></ic-checkbox></ic-checkbox-group>
<IcCheckboxGrouplabel="Select your extras"name="1"helperText="Additional charges may apply."><IcCheckboxvalue="valueName1"label="Extra shot (50p)"/><IcCheckboxvalue="valueName2"label="Soya milk"checked/></IcCheckboxGroup>
Sizes
Interactive example
<ic-checkbox-grouplabel="Select your extras"name="1"size="small"><ic-checkboxvalue="valueName1"label="Extra shot (50p)"></ic-checkbox><ic-checkboxvalue="valueName2"label="Soya milk"checked="true"></ic-checkbox></ic-checkbox-group><ic-checkbox-grouplabel="Select your extras"name="2"><ic-checkboxvalue="valueName1"label="Extra shot (50p)"></ic-checkbox><ic-checkboxvalue="valueName2"label="Soya milk"checked="true"></ic-checkbox></ic-checkbox-group><ic-checkbox-grouplabel="Select your extras"name="3"size="large"><ic-checkboxvalue="valueName1"label="Extra shot (50p)"></ic-checkbox><ic-checkboxvalue="valueName2"label="Soya milk"checked="true"></ic-checkbox></ic-checkbox-group>
<IcCheckboxGrouplabel="Select your extras"name="1"size="small"><IcCheckboxvalue="valueName1"label="Extra shot (50p)"/><IcCheckboxvalue="valueName2"label="Soya milk"checked/></IcCheckboxGroup><IcCheckboxGrouplabel="Select your extras"name="2"><IcCheckboxvalue="valueName1"label="Extra shot (50p)"/><IcCheckboxvalue="valueName2"label="Soya milk"checked/></IcCheckboxGroup><IcCheckboxGrouplabel="Select your extras"name="3"size="large"><IcCheckboxvalue="valueName1"label="Extra shot (50p)"/><IcCheckboxvalue="valueName2"label="Soya milk"checked/></IcCheckboxGroup>
Setting each checkbox size
Interactive example
<ic-checkboxvalue="valueName1"label="Extra shot (50p)"size="small"/><ic-checkboxvalue="valueName2"label="Extra shot (50p)"/><ic-checkboxvalue="valueName3"label="Extra shot (50p)"size="large"/>
<IcCheckboxvalue="valueName1"label="Extra shot (50p)"size="small"/><IcCheckboxvalue="valueName2"label="Extra shot (50p)"/><IcCheckboxvalue="valueName3"label="Extra shot (50p)"size="large"/>
Conditional
Interactive example
<ic-checkbox-grouplabel="Which coffee do you like best?"name="conditional"><ic-checkboxvalue="americano"label="Americano"></ic-checkbox><ic-checkboxvalue="espresso"label="Espresso"></ic-checkbox><ic-checkboxvalue="flatwhite"label="Flat white"></ic-checkbox><ic-checkboxvalue="latte"label="Latte"></ic-checkbox><ic-checkboxvalue="cappuccino"label="Cappuccino"></ic-checkbox><ic-checkboxvalue="other"label="Other"><ic-text-fieldslot="additional-field"label="Please let us know..."></ic-text-field></ic-checkbox></ic-checkbox-group>
<IcCheckboxGrouplabel="Which coffee do you like best?"name="conditional"><IcCheckboxvalue="americano"label="Americano"/><IcCheckboxvalue="espresso"label="Espresso"/><IcCheckboxvalue="flatwhite"label="Flat white"/><IcCheckboxvalue="latte"label="Latte"/><IcCheckboxvalue="cappuccino"label="Cappuccino"/><IcCheckboxvalue="other"label="Other"><IcTextFieldslot="additional-field"label="Please let us know..."/></IcCheckbox></IcCheckboxGroup>
Conditional dynamic
Interactive example
<ic-checkbox-grouplabel="Which coffee do you like best?"name="dynamic"><ic-checkboxvalue="americano"label="Americano"></ic-checkbox><ic-checkboxvalue="espresso"label="Espresso"></ic-checkbox><ic-checkboxvalue="flatwhite"label="Flat white"></ic-checkbox><ic-checkboxvalue="latte"label="Latte"></ic-checkbox><ic-checkboxvalue="cappuccino"label="Cappuccino"></ic-checkbox><ic-checkboxadditional-field-display="dynamic"value="other"label="Other"><ic-text-fieldslot="additional-field"label="Please let us know..."></ic-text-field></ic-checkbox></ic-checkbox-group>
<IcCheckboxGrouplabel="Which coffee do you like best?"name="dynamic"><IcCheckboxvalue="americano"label="Americano"/><IcCheckboxvalue="espresso"label="Espresso"/><IcCheckboxvalue="flatwhite"label="Flat white"/><IcCheckboxvalue="latte"label="Latte"/><IcCheckboxvalue="cappuccino"label="Cappuccino"/><IcCheckboxadditionalFieldDisplay="dynamic"value="other"label="Other"><IcTextFieldslot="additional-field"label="Please let us know..."/></IcCheckbox></IcCheckboxGroup>
Validation
Interactive example
<ic-checkbox-grouplabel="Select your extras"name="1"validation-status="error"validation-text="Sorry, this is currently unavailable."><ic-checkboxvalue="valueName1"label="Extra shot (50p)"></ic-checkbox><ic-checkboxvalue="valueName2"label="Soya milk"checked="true"></ic-checkbox></ic-checkbox-group>
<IcCheckboxGrouplabel="Select your extras"name="1"validationStatus="error"validationText="Sorry, this is currently unavailable."><IcCheckboxvalue="valueName1"label="Extra shot (50p)"/><IcCheckboxvalue="valueName2"label="Soya milk"checked/></IcCheckboxGroup>
Indeterminate
Interactive example
<ic-checkbox-grouplabel="Select your preferred drinks"name="1"><ic-checkboxvalue="drinks"label="Drinks"checked="true"indeterminate="true"><ic-checkbox-grouplabel="Coffee"hide-label="true"slot="additional-field"name="2"><ic-checkboxvalue="tea"label="Tea"></ic-checkbox><ic-checkboxvalue="coffee"label="Coffee"checked="true"indeterminate="true"><ic-checkbox-grouplabel="Coffees"hide-label="true"slot="additional-field"name="3"><ic-checkboxvalue="mocha"label="Mocha"></ic-checkbox><ic-checkboxvalue="espresso"label="Espresso"checked="true"></ic-checkbox><ic-checkboxvalue="cappuccino"label="Cappuccino"></ic-checkbox></ic-checkbox-group></ic-checkbox><ic-checkboxvalue="juice"label="Juice"></ic-checkbox></ic-checkbox-group></ic-checkbox></ic-checkbox-group>
<IcCheckboxGrouplabel="Select your preferred drinks"name="1"><IcCheckboxvalue="drinks"label="Drinks"checkedindeterminate><IcCheckboxGroupname="2"label="Coffee"hideLabelslot="additional-field"><IcCheckboxvalue="tea"label="Tea"/><IcCheckboxvalue="coffee"label="Coffee"checkedindeterminate><IcCheckboxGrouplabel="Coffees"hideLabelslot="additional-field"name="3"><IcCheckboxvalue="mocha"label="Mocha"/><IcCheckboxvalue="espresso"label="Espresso"checked/><IcCheckboxvalue="cappuccino"label="Cappuccino"/></IcCheckboxGroup></IcCheckbox><IcCheckboxvalue="juice"label="Juice"/></IcCheckboxGroup></IcCheckbox></IcCheckboxGroup>
Theme
Interactive example
<ic-checkbox-grouptheme="dark"label="Select your extras"name="default"><ic-checkboxvalue="extra"label="Extra shot (50p)"></ic-checkbox><ic-checkboxvalue="Soya milk"label="Soya milk"checked></ic-checkbox><ic-checkboxvalue="keep cup"label="Takeaway cup"disabled="true"></ic-checkbox></ic-checkbox-group>
<IcCheckboxGrouptheme="dark"label="Select your extras"name="default"><IcCheckboxvalue="extra"label="Extra shot (50p)"/><IcCheckboxvalue="Soya milk"label="Soya milk"checked/><IcCheckboxvalue="keep cup"label="Takeaway cup"disabled/></IcCheckboxGroup>