Skip to content

CdsCheckboxButton

New in v4.0

The checkbox control without a label and a messages block — the atom CdsCheckbox is built on. Use it where the caption is not needed or lives outside: in a table cell, a list row, a card.

Storybook GitLab Figma
Test coverage: 100% — good coverage
API in specs
33 / 33 props, events, slots and exposed members with a test
Test cases
17 unit · 0 browser · 2 planned
Known bugs
5 pinned by an it.fails test
Code coverage
100% lines · 100% branches measured in v4.0.0-alpha.13
A11y (axe)
1 recommendations in 1 stories measured in v4.0.0-alpha.11

For a standalone option with a label, a description and validation use CdsCheckbox — states, colors and groups work the same way here and are described in detail on its page.

Basic example ​

The control is driven through v-model, indeterminate shows the intermediate state, disabled blocks the choice. There is no visible label, so add an aria-label — that way the control stays clear for screen readers.

API ​

Props

NameTypeDefaultDescription
activeColorstring | undefined—Color of the component in its active state
baseColorstring | undefined—Color of the component in its inactive state
bgColorstring | undefined—Background color of the component
colorstring | undefined—Component color
defaultsTargetstring | undefined—Name of the child component the group prop values are passed to as defaults
descriptionstring | undefined—Description of the component, shown under the label
direction"horizontal" | "vertical" | undefined'horizontal'Switches the component between horizontal and vertical layout.
disabledboolean | null | undefinednullDisabled state
errorboolean | undefined—Puts the component into the visual error state
falseIconIconValue | undefined'checkbox-off'Icon of the unselected state
falseValueany—Value for the false state.
idstring | undefined—Unique identifier of the component
indeterminateboolean | undefined—Indeterminate state of the checkbox.
indeterminateIconIconValue | undefined'checkbox-indeterminate-fill'Icon shown in the indeterminate state.
inlineboolean | undefined—Renders the control as an inline element — the container does not stretch to the full width
labelstring | undefined—Label text of the component
modelValueany—Value of the component (v-model). In a group it is the value of the selected control, with multiple — an array of the selected values
multipleboolean | null | undefinednullAllows selecting several values — the model becomes an array. Turns on automatically when an array is passed to modelValue
namestring | undefined—The name attribute of the native input element. In a group one name joins all the nested controls
readonlyboolean | null | undefinednullRead-only state
textColorstring | undefined—Text color of the component
themestring | undefined—Component theme
trueIconIconValue | undefined'checkbox-on-fill'Icon of the selected state
trueValueany—Value for the true state.
typestring | undefined—Type of the native input element — radio or checkbox, for example
valueany—Value used when the component is selected inside a group. When it is not set, a unique identifier is used.
valueComparatorValueComparator | undefinedtrueFunction comparing the model value with the value of the control. Deep comparison by default

Events

NameTypeDescription
update:indeterminate[value: boolean]Fired when the indeterminate state of the checkbox changed
update:modelValue[value: boolean]Fired when the checkbox was toggled. Passes the new state

Slots

NameTypeDescription
default{ backgroundColorClasses: Ref<string[], string[]>; backgroundColorStyles: Ref<CSSProperties, CSSProperties>; }Default slot
description{ description: string | undefined; props: Record<string, any>; }Default slot of the CdsDescription component
inputSelectionControlSlotSlot for the default input element.
label{ label: string | undefined; props: Record<string, any>; }Default slot of the CdsLabel component