Skip to main content

Features

API#

DOM Structure#

SlotDescription
indicatorCreates the indicator, and can be styles based on the checkbox's current state
labelCreates the label and associates it to the control
PartDescription
indicatorAn outer wrapper around the indicator
labelAn outer wrapper around the label

Attributes#

NameTypeDefaultDescription
checkedbooleanfalseWhether or not the checkbox's value is checked, if set to true the checkbox displays the contents of the checked-indicator slot
defaultCheckedbooleanfalseWhether the checkbox is checked by default when added to the DOM. Does nothing if checked is explicitly set
disabledstring-When set the checkbox cannot be interacted with
indeterminatebooleanfalseWhen set to true the checkbox displays the contents of the intermediate-indicator slot
valuestring"on"The value of the checkbox
namestring-The name of the checkbox for form submission purposes. Required if submitting values to a form.
requiredbooleanfalseWhether or not the checkbox is required for form submission. This value is ignored if the checkbox is disabled
formstring-Associates the element with a form in the document whose id is this value.

Events#

Event NameBubblesComposedCancellableDispatch Behavior
changetruetruefalseFired when the checkbox's state changes.
inputtruetruefalseFired when the checkbox's state changes.