Skip to main content

CheckboxInput

Introduction​

This is a single checkbox input field. It will sometimes be part of a fieldset.

Note: Make sure to include a label for this input.

Live demo​

CSS custom properties​

Use these properties to theme checkbox colours. Linked properties follow their fallback unless they are set directly. See Theming for how to apply custom properties.

PropertyTypeDefault valueFallback valueDescription
--rpf-input-checkbox-checked-background-colorLinked—var(--rpf-input-color)Checked checkbox background colour
--rpf-input-background-colorIndependentvar(--rpf-white)—Unchecked checkbox background colour
--rpf-input-colorIndependentvar(--rpf-text-primary)—Fallback colour for the checked checkbox background
--rpf-input-color-disabledIndependentvar(--rpf-grey-500)—Disabled label colour and checked checkbox background and border colour
--rpf-input-color-errorIndependentvar(--rpf-alert-error)—Checkbox border and checked-background colour in an error state
--rpf-label-text-color-disabledLinked—var(--rpf-input-color-disabled)Disabled label text colour

The checkbox tick remains white and is not themeable, so choose a checked background with sufficient contrast.

Implementation:​