Checkbox

Checkboxes allow users to select one or more items from a predefined list of independent options.

On this page

Import

Default Checkbox

Loading preview
Open in Storybook

Checkbox Group

Loading preview
Open in Storybook

Checkbox Indeterminate Group

Loading preview
Open in Storybook

Props

Checkbox Group Props

NameDescriptionDefault
children*

Children to render in the checkbox group

NonNullable<ReactNode>
-
legend*

A string or elements to be placed on the legend

string | ReactElement<any, string | JSXElementConstructor<any>>
-
isLegendVisuallyHidden

If true, visually hides the legend element but it will still be available to screen readers

boolean
-
orientation

Controls the orientation that the CheckboxGroup's children are rendered in.

"horizontal" | "vertical"
vertical
aria-invalid

Flag to indicate that each Checkbox in the CheckboxGroup is in an invalid state

Booleanish
-
statusMessage

The status message to be displayed. Will only be displayed if aria-invalid is true

string
-
reactlytics
ReactlyticsProp
-

Checkbox Props

NameDescriptionDefault
id*

The id of the input field

string
-
label*

A string or elements to be placed on the label

string | ReactElement<any, string | JSXElementConstructor<any>>
-
checked

The checked state of the checkbox

boolean
-
defaultChecked

Flag to use the component in an uncontrolled setting

boolean
-
aria-invalid

Flag to indicate that the field is in a warning state

Booleanish
-
value

The string representing the value of the checkbox

string
-
name

The name of the checkbox

string
-
aria-describedby

ID of element providing further context and description of the link

string
-
onChange

The event handler for change events on the input field

ChangeEventHandler<HTMLInputElement>
-
labelProps

Props to be spread onto the

Omit<DetailedHTMLProps<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref">
-
iconProps

Props to be spread onto the <IconCheck> component

any
-
statusMessage

The status message to be displayed. Will only be displayed if aria-invalid is true

string
-
reactlytics
ReactlyticsProp
-
disabled

@deprecated use aria-disabled instead.

The disabled prop removes the element from the Accessibility Tree and prevents it from receiving focus. This is not recommended.

All DLS components are designed to use the aria-disabled property instead, which will style the component to be disabled, but still allow keyboard focus and screen reader interactivity.

boolean
-
aria-disabled

If true, styles component as disabled and prevents interactivity. Screen reader reads as "dimmed" or "disabled".

Booleanish
-

Checkbox Indeterminate Props

NameDescriptionDefault
aria-controls*

identifies the element (or elements) whose contents or presence are controlled

string
-
checked

The checked state of the indeterminate checkbox (controlled)

boolean
-
defaultChecked

The default checked state of the Indeterminate Checkbox (uncontrolled component).

boolean
-
isIndeterminate

Flag to indicate whether the checkbox is in an indeterminate state

boolean
-
onClick

The event handler for click events on the indeterminate checkbox

((event: MouseEvent<Element, MouseEvent>, checked: boolean) => void)
-
reactlytics
ReactlyticsProp
-
label*

A string or elements to be placed on the label

string | ReactElement<any, string | JSXElementConstructor<any>>
-
id*

The id of the input field

string
-
aria-disabled

If true, styles component as disabled and prevents interactivity. Screen reader reads as "dimmed" or "disabled".

Booleanish
-
aria-invalid

Flag to indicate that the field is in a warning state

Booleanish
-
value

The string representing the value of the checkbox

string
-
name

The name of the checkbox

string
-
disabled

@deprecated use aria-disabled instead.

The disabled prop removes the element from the Accessibility Tree and prevents it from receiving focus. This is not recommended.

All DLS components are designed to use the aria-disabled property instead, which will style the component to be disabled, but still allow keyboard focus and screen reader interactivity.

boolean
-

Questions?

Connect with the DLS Team on Slack or by email.

Resources

Check out additional resources.