Skip to main content

BwCheckbox | bw-checkbox

Overview

The checkbox component is a form control that represent the absence or presence of a condition.

Usage

Variants

BasicLargeRequiredIndeterminateStarting labelEnding Label
<bw-checkbox>Basic</bw-checkbox>
<bw-checkbox large>Large</bw-checkbox>
<bw-checkbox required>Required</bw-checkbox>
<bw-checkbox indeterminate>Indeterminate</bw-checkbox>
<bw-checkbox label-placement="start">Starting label</bw-checkbox>
<bw-checkbox label-placement="end">Ending Label</bw-checkbox>

Properties

PropertyAttributeDescriptionTypeDefault
disableddisabledShows the disabled state and prevents changesbooleanfalse
errorerrorShows an error icon. If a string is passed in, it will render the icon as a tooltip. Has no effect on form validationanyundefined
indeterminateindeterminateIf the checkbox should contain a 3rd indeterminate statebooleanfalse
labelPlacementlabel-placementWhether or not the label should go before or after the checkbox"end" | "start"'end'
largelargeMakes checkbox biggerbooleanfalse
notenoteInformative text that shows below the controlstringundefined
originalValueoriginal-valueThe value the control will reset to. Defaults to the initial value if not set.booleanundefined
pendingpendingShows a loading indicatorbooleanfalse
requiredrequiredIs the checkbox requiredbooleanfalse
successsuccessShows a success icon. Has no effect on form validationbooleanfalse
valuevalueWhether or not the checkbox is activebooleanundefined

Events

EventDescriptionType
valueChangeEmits the current value whenever it's state changesCustomEvent<boolean>

Methods

checkValidity() => Promise<boolean>

Checks the validity of the checkbox

Returns

Type: Promise<boolean>

true if the checkbox is valid, false otherwise

getCustomError() => Promise<string>

Gets the custom validity of the checkbox

Returns

Type: Promise<string>

The custom validity of the checkbox

reportValidity() => Promise<boolean>

Reports the validity of the checkbox

Returns

Type: Promise<boolean>

true if the checkbox is valid, false otherwise

setCustomValidity(message: string | null) => Promise<void>

Sets the custom validity of the checkbox

Parameters

NameTypeDescription
messagestring- The message to set the custom validity to

Returns

Type: Promise<void>

Slots

SlotDescription
The content of the checkbox
"note"The note of the checkbox

Shadow Parts

PartDescription
"label"The label of the checkbox
"main"The main container of the checkbox

Custom States

StateInitial ValueDescription
:state(--checked)falseCheckbox is checked (value === true)
:state(--indeterminate)falseCheckbox is neither checked or unchecked (value === undefined)
:state(--invalid)falseCheckbox is in an invalid form state
:state(--optional)trueCheckbox is not required to be checked in the form (required === false)
:state(--required)falseCheckbox is required to be checked in the form (required === true)
:state(--unchecked)trueCheckbox is not checked (value === false)
:state(--valid)trueCheckbox is in a valid form state

Dependencies

Used by

Depends on

Graph


© 2025 United Systems & Software - All Rights Reserved.