Skip to main content

Checkbox

shadow

A checkbox, or also a check box, is an element that allows users to select one or more options from a set. Click on the checkbox to change its status to true or false.

Basic usage

This example shows the checkbox in its default state with a standard label. It is the best starting point for simple form choices.

Placement End

This example moves the related content to the opposite side of the checkbox, which is useful in tighter or denser form layouts.

Color

This example compares checkbox color variants so you can see how semantic states affect the overall visual tone.

Indeterminate checkbox

When the indeterminate attribute is added, a checkbox is displayed whose default state is neutral, i.e. neither true nor false.

Variant

Adding the variant attribute with the value circle will display a checkbox in a round shape.

CSS custom properties

When you need to adjust the checkbox outline or spacing without changing markup, use the component CSS variables.

When to use

Use wje-checkbox when users need to enter values, choose options, or trigger form-related actions.

When not to use

Do not use it as a decorative element without interaction. Prefer presentational components in that case.

Accessibility

Always provide a label (label/aria-label), keep keyboard support, and surface clear validation feedback.

Best Practices

  • Keep validation rules and error behavior consistent across the entire form.
  • Show loading or disabled states during async operations.
  • Split complex forms into smaller sections with immediate feedback.

Attributes and Properties

checked

DescriptionSet checked attribute.
Attributechecked
Typeboolean
Defaultfalse

customErrorDisplay

DescriptionGetter for the customErrorDisplay attribute.
Attributecustom-error-display
Typeboolean
Defaultfalse

disabled

DescriptionDisables user interaction with the component.
Attributedisabled
Typeboolean
Default-

indeterminate

DescriptionRetrieves the current state of the 'indeterminate' attribute. The 'indeterminate' attribute is typically used to signify a state where a checkbox is neither checked nor unchecked, such as a partially selected state.
Attributeindeterminate
Typeboolean
Defaultfalse

invalid

DescriptionControls validation or status messaging for invalid.
Attributeinvalid
Typeboolean
Defaultfalse

label

DescriptionSetter for the label attribute.
Attributelabel
Typestring
Default-

required

DescriptionMarks the component as required for form validation.
Attributerequired
Typeboolean
Default-

validateOnChange

DescriptionGetter for the validateOnChange attribute.
Attributevalidate-on-change
Typeboolean
Defaultfalse

value

DescriptionGetter for the value attribute.
Attributevalue
Typestring
Defaulton

Events

NameDescription
wje-toggle:inputEmitted when the input value changes.
wje-toggle:changeEmitted when the component value changes.

Methods

No public methods available for this component.

CSS Shadow Parts

NameDescription
nativeThe component's native wrapper.

CSS Custom Properties

NameDescription
--wje-checkbox-border-radiusBorder radius of the component;.
--wje-checkbox-border-widthBorder width of the component;.
--wje-checkbox-border-styleBorder style of the component;.
--wje-checkbox-border-colorBorder color of the component;.
--wje-checkbox-margin-inlineMargin inline of the component;.

Slots

NameDescription
defaultDefault slot for the main component content.