Skip to main content

ICheckbox

View source on GitHub

Custom checkbox.

checkboxcheckbox

Example

Privacy policy checkbox with submit button state control

const privacyCheckbox: ICheckbox = {
isChecked: false,
label: "I agree to the Privacy Policy",
onChange: () => {
return {
actions: [Actions.updateProps, Actions.updateContext],
newProps: {
isChecked: !privacyCheckbox.isChecked
},
contextProps: [{
name: "submitButton",
props: {
isDisabled: !privacyCheckbox.isChecked
}
}]
};
},
truncate: false,
tabIndex: 1,
hasError: false,
name: "privacy-policy",
value: "accepted",
isIndeterminate: false,
isDisabled: false,
title: "Privacy Policy Agreement"
}

Properties

PropertyTypeDescription
isCheckedbooleanSets the checked state of the checkbox
label?stringDefines the checkbox label
onChange() => void | IMessageSets a function which is triggered whenever the checkbox input is clicked
truncate?booleanSpecifies if the word wrapping is disabled or not
tabIndex?numberDefines the checkbox tab index
hasError?booleanSpecifies whether a notification will be sent if an error occurs
name?stringDefines the HTML "name" property
value?stringDefines the checkbox input value
isIndeterminate?booleanSpecifies whether the checkbox state will be displayed as a black rectangle in the checkbox when it is set to true
isDisabled?booleanSpecifies if the checkbox input is disabled
title?stringDefines the checkbox input title
className?stringDefines the CSS class for styling the component. Can be used to override or extend the default component styles.