Checkbox component is a form element that allows the user to select one or more options from a list of options.
The checkbox component comes in three sizes: small, and large. The default size is small.
The checkbox component comes with a secondary text. The secondary text is used to give more information about the checkbox.
The checkbox component can have different statuses.
The checkbox component can be used in a group. The checkbox group is used to group multiple checkboxes together.
You can use the tooltipAriaLabel
property to set the aria label for the tooltip.
The checkbox component can have background. It is useful when used on a colored background.
It can be set with type="background"
property. Default border can be set also with border
property.
The checkbox component can have border with border
property.
import { DapDSCheckbox } from 'dap-design-system/dist/dds'
import { DapDSCheckboxReact } from 'dap-design-system/dist/react'
Property | Type | Default | Description |
---|---|---|---|
indeterminate | boolean | false | Whether the checkbox is indeterminate |
preventDefault | boolean | false | Whether the checkbox should prevent the default action |
border | boolean | false | This sets up border around the checkbox, when true. |
type | 'normal' , 'background' | 'normal' | The type of the checkbox |
name | string | The name of the checkbox. | |
value | string | The value of the checkbox. | |
checked | boolean | Whether the checkbox is checked. | |
label | string | The label of the checkbox. | |
description | string | The description of the checkbox. | |
disabled | boolean | Whether the checkbox is disabled. | |
required | boolean | Whether the checkbox is required. | |
size | 'xs' , sm' , 'md' , 'lg' | The size of the checkbox. | |
labelPlacement | 'left' , 'right' | The placement of the label. | |
descriptionPlacement | 'top' , 'bottom' | The placement of the description. | |
subtle | boolean | The weight of the label. | |
feedback | string | The feedback of the checkbox. | |
feedbackType | 'negative' , 'positive' , 'warning' | The feedback type of the checkbox. | |
invalid | boolean | The invalid state of the checkbox. | |
optional | boolean | The optional state of the checkbox. | |
optionalLabel | string | The optional label of the checkbox. |
No slots available.
Event Name | Description | Type |
---|---|---|
dds-change | Fired when the checkbox is checked or unchecked. | {checked: boolean, indeterminate: boolean, value: string, disabled: boolean, type: 'checkbox' } |
dds-blur | Emitted when the checkbox loses focus. | {void } |
dds-focus | Emitted when the checkbox gains focus. | {void } |
dds-input | Emitted when the checkbox receives input. | {checked: boolean, indeterminate: boolean, value: string, disabled: boolean } |
Part Name | Description |
---|---|
base | The main checkbox container. |
label | The label of the checkbox. |
input | The input of the checkbox. |
control | The control of the checkbox. |
icon | The icon of the checkbox. |
label-container | The label container of the checkbox. |
description | The description of the checkbox. |
Property Name | Description |
---|---|
--dds-checkbox-size | The size of the checkbox. Default is `var(--dds-spacing-500)`. |
--dds-checkbox-border-width | The border width of the checkbox. Default is `var(--dds-border-width-large)`. |
--dds-checkbox-border-radius | The border radius of the checkbox. Default is `var(--dds-radius-small)`. |
--dds-checkbox-border-color | The border color of the checkbox. Default is `var(--dds-border-neutral-base)`. |
--dds-checkbox-background-color | The background color of the checkbox. Default is `transparent`. |
--dds-checkbox-icon-color | The color of the checkbox icon. Default is `var(--dds-button-primary-icon-enabled)`. |
--dds-checkbox-hover-border-color | The border color when hovering over the checkbox. Default is `var(--dds-border-neutral-medium)`. |
--dds-checkbox-hover-background-color | The background color when hovering over the checkbox. Default is `var(--dds-background-neutral-medium)`. |
--dds-checkbox-active-border-color | The border color when the checkbox is active. Default is `var(--dds-border-neutral-strong)`. |
--dds-checkbox-active-background-color | The background color when the checkbox is active. Default is `var(--dds-background-neutral-strong)`. |
--dds-checkbox-checked-border-color | The border color when the checkbox is checked. Default is `var(--dds-background-brand-base-inverted)`. |
--dds-checkbox-checked-background-color | The background color when the checkbox is checked. Default is `var(--dds-background-brand-base-inverted)`. |
--dds-checkbox-checked-hover-border-color | The border color when hovering over a checked checkbox. Default is `var(--dds-background-brand-medium-inverted)`. |
--dds-checkbox-checked-hover-background-color | The background color when hovering over a checked checkbox. Default is `var(--dds-background-brand-medium-inverted)`. |
--dds-checkbox-checked-active-border-color | The border color when a checked checkbox is active. Default is `var(--dds-background-brand-strong-inverted)`. |
--dds-checkbox-checked-active-background-color | The background color when a checked checkbox is active. Default is `var(--dds-background-brand-strong-inverted)`. |
--dds-checkbox-invalid-border-color | The border color when the checkbox is invalid. Default is `var(--dds-border-negative-base)`. |
--dds-checkbox-invalid-background-color | The background color when the checkbox is invalid. Default is `var(--dds-background-negative-base)`. |
--dds-checkbox-invalid-hover-border-color | The border color when hovering over an invalid checkbox. Default is `var(--dds-border-negative-medium)`. |
--dds-checkbox-invalid-hover-background-color | The background color when hovering over an invalid checkbox. Default is `var(--dds-background-negative-medium)`. |
--dds-checkbox-invalid-active-border-color | The border color when an invalid checkbox is active. Default is `var(--dds-border-negative-strong)`. |
--dds-checkbox-invalid-active-background-color | The background color when an invalid checkbox is active. Default is `var(--dds-background-negative-strong)`. |
--dds-checkbox-disabled-border-color | The border color when the checkbox is disabled. Default is `var(--dds-button-primary-background-disabled)`. |
--dds-checkbox-disabled-background-color | The background color when the checkbox is disabled. Default is `var(--dds-button-primary-background-disabled)`. |
--dds-checkbox-disabled-icon-color | The color of the checkbox icon when disabled. Default is `var(--dds-button-primary-icon-disabled)`. |