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.

Property
Value
Default

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


Use for compact information display

Organise dense or hierarchical content like FAQs, step-by-step instructions

Change log


Date
Number
Notes

Design Checklist


All interactive states

Accessible use of colours

Accessible contrast for text

Accessible contrast for UI components

Keyboard interactions

Last updated

Was this helpful?