tuix-checkbox

A checkbox with a label on either side and an error state.

Loading the components…

States

Loading the components…

error is ignored while the box is disabled.

Label side

Loading the components…

Rich labels

The default slot replaces the label text. It is the right choice when the label contains a link or extra styling.

Loading the components…

Events

Loading the components…
checkbox.addEventListener('change', (event) => {
    console.log(event.detail.value, event.detail.label)
})

API

Properties

PropertyAttributeTypeDefaultDescription
checkedcheckedbooleanfalseChecked state
labellabelstring''Label text, rendered with TextSize.FieldPlaceholder
labelSidelabelsideCheckboxLabelSiderightleft or right
disableddisabledbooleanfalseBlocks interaction
errorerrorbooleanfalseRed box and label. Ignored while disabled
darkdarkbooleanfalseDark palette

Events

EventDetailWhen
change{ value: boolean, label?: string }The user toggles the box

Typed as CustomEventTuixCheckbox with a DetailValueCheckbox payload.

Slots

SlotContent
defaultReplaces the label text

Notes

  • The whole row is a <label>, so clicking the text toggles the box.
  • checked is not reflected to the attribute: it is read as a property.
  • Like the input, the component does not own its state; checked is written back from the change handler.

On this page