Skip to content

Checkbox ​

bo-checkbox wraps a native checkbox input with Bamboo styling, labels, helper text, and an indeterminate state.

Usage ​

Use v-model for the boolean checked state. The model defaults to false.

Checked: false

<bo-checkbox v-model="accepted" label="Accept the terms" />

States and Sizes ​

Set indeterminate to show the mixed state. disabled, required, hint, and error are reflected on the native input. Sizes are sm, default, and lg.

Choose an option
<bo-checkbox v-model="accepted" label="Selected" />
<bo-checkbox label="Disabled" disabled />
<bo-checkbox v-model="indeterminate" label="Indeterminate" indeterminate />
<bo-checkbox label="Invalid" error="Choose an option" />

The default slot can provide custom label content when label is not enough.

Accessibility ​

The control is a native checkbox associated with its generated label. Error text is exposed through aria-describedby and invalid state through aria-invalid.

API Reference ​

Props ​

PropTypeDefaultDescription
idstringAutogeneratedId of the native input.
dataTestIdstringAutogeneratedTest id of the input.
modelValuebooleanfalseChecked state used by v-model.
disabledbooleanfalseDisables the input.
namestring-Native form name.
valuestring-Native submitted value.
indeterminatebooleanfalseShows the mixed state.
labelstring-Visible label text.
size'sm' | 'default' | 'lg'defaultCheckbox size.
requiredbooleanfalseMarks the input as required.
hintstring-Helper text shown when there is no error.
errorstring-Error text and invalid state.
roleHTMLAttributes['role']-Optional ARIA role for the input.
ariaLabelstring-Accessible name for the input.
ariaDescribedBystring-Id of an external description.

Events ​

EventPayloadDescription
update:modelValuebooleanEmitted when the checked state changes.

Slots ​

NameDescription
defaultCustom content in the label area.

Released under the MIT License.