Checkbox
Design System - Checkbox component
The Checkbox is a simple selection control that allows users to make binary choices, such as selecting or deselecting options. It is commonly used in forms, preference settings, and multi-select scenarios, providing clear visual feedback for user actions.

// Sample code
<CheckBox
label="Label"
onChange={(e)=>{console.log(e.target.checked}}
/>
Anatomy

Variants
Checked
The checked state indicates that the user has actively selected the option. It provides clear visual feedback with a filled checkbox, often accompanied by a checkmark. This state should be used when an option is explicitly chosen or enabled by default.
Intermediate The indeterminate state represents a mixed selection, typically used for parent checkboxes in multi-select scenarios. It visually signals that only some child options are selected, rather than all. This state does not appear by direct user interaction but is controlled programmatically to reflect partial selections.
Unchecked
The unchecked state indicates that the option is not selected. It appears as an empty checkbox, providing a clear visual cue that no action has been taken. This is the default state unless specified otherwise.
Properties
Label This property represents the text displayed inside the button. It is a required field and helps users understand the action that the button will trigger. The label should be concise and clear to communicate the button’s purpose effectively.
Disabled The “isDisabled” property disables the button, preventing any user interaction. It also applies a disabled visual style (like graying out the button) to indicate that the button is not active.
Icon The icon property specifies the name of the icon to be rendered inside the button. This helps provide a visual cue along with the button text. The icon placement can be either before or after the label based on the how the “Prefix” and “Suffix” properties are defined.
Size The size property specifies the size of the button. You can choose between "large", "medium", and "small" to adjust the button's height and font size.
Type The type property determines the HTML type attribute for the button, such as "submit", "button", or "actionButton". This is useful for form submission or defining button behavior in HTML forms.
Property Configuration Table
Each design component offers a range of configurable options. These options are intentionally platform-agnostic, allowing implementations to adapt and tailor them to align with the specific requirements of the chosen framework.
label
string
-
onChange
function
-
value
string
-
disabled
boolean
-
inputRef
reference to a DOM element
-
checked
boolean
false
pageType
string
-
style
object
-
index
number
0
isLabelFirst
boolean
false
hideLabel
boolean
-
isIntermediate
boolean
false
mainClassName
string
-
id
-
labelClassName
string
-
onLabelClick
function
-
inputWrapperClassName
string
-
inputClassName
string
-
inputIconClassname
string
-
iconFill
string
-
Interaction State
Hover State
When a user hovers over the button, a visual cue is added to emphasize interactivity. This is achieved by introducing a subtle line below the button. The line appears as a clean, horizontal underline that complements the button's style, without overwhelming the design. The hover state enhances the button's affordance, guiding users and improving interactivity without altering the button’s primary layout or design.
Mousedown State
The Mouse Down state of the button represents the moment when the user clicks and holds the button. This state provides immediate feedback to the user, confirming that their interaction has been registered. The text label becomes bolder, emphasizing the active interaction
Usage Guide

Usage for multiselection
Checkboxes should be used when users need to select any number of choices from a list of options. They are appropriate when presenting independent options where multiple selections are allowed simultaneously.

Avoid interchanging checkboxes with Radio buttons
Checkboxes should be used when users need to select any number of options from a list (including zero, one, or multiple selections). They represent independent choices that don't affect each other. Checkboxes work well for "opt-in" scenarios, toggling features on/off, or when users need to select multiple items from a visible set of options. Radio buttons, by contrast, should only be used when users must select exactly one option from a set of mutually exclusive choices. Using checkboxes when a single selection is required creates confusion and violates established interaction patterns, potentially leading to user frustration and errors.
Changelog
Dec 15, 2024
v-0.0.2
This component is added to the website. This component is now individually versioned.
Design Checklist
All interactive states - Includes all interactive states that are applicable (hover, down, focus, keyboard focus, disabled).
Accessible use of colours - Colour is not used as the only visual means of conveying information (WCAG 2.1 1.4.1)
Accessible contrast for text - Text has a contrast ratio of at least 4.5:1 for small text and at least 3:1 for large text (WCAG 2.0 1.4.3).
Accessible contrast for UI components - Visual information required to identify components and states (except inactive components) has a contrast ratio of at least 3:1 (WCAG 2.1 1.4.11).
Keyboard interactions - Includes all interactive states that are applicable (hover, down, focus, keyboard focus, disabled).
Screen reader accessible - All content, including headings, labels, and descriptions, is meaningful, concise, contextual and accessible by screen readers.
Responsive for all breakpoints - Responsiveness for 3 breakpoints - Mobile, Tablet and Desktop
Usage guidelines - Includes a list of dos and don'ts that highlight best practices and common mistakes.
Content guidelines - Content standards and usage guidelines for writing and formatting in-product content for the component.
Defined variants and properties - Includes relevant variants and properties (style, size, orientation, optional iconography, decorative elements, selection states, error states, etc.)
Defined behaviours - Guidelines for keyboard navigation and focus, layout management (including wrapping, truncation, and overflow), animations, and user interactions.
Design Kit - Access to the design file for the component in Figma, multiple options, states, colour themes, and platform scales.
Last updated
Was this helpful?