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​

The sample shows the checkbox in its default state with the normal label. This is a good starting point for simple form options.

Placement End​

The preview moves the content behind the checkbox to the opposite side, which is useful where you need a more compact or dense form layout.

Color​

The demo compares the color variations of the checkbox to show how the visual changes for different meaning states.

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 variables​

When you need to adjust the outline or spacing of a checkbox without affecting the markup, use its CSS variables.

When to use​

Use wje-checkbox when the user enters a value, selects options, or performs an action on a form.

When not to use​

Don't just use it as a visual decorative element without interaction. In this case, give priority to the presentation components.

Accessibility​

Always link the component to the description (label/aria-label), keep keyboard control, and display a clear message on validation errors.

  • Keep validation rules and error states consistent across the entire form.
  • For asynchronous operations, display the load status or disabled status.
  • For complex forms, prefer smaller sections and immediate feedback.

Attributes and properties​

checked​

PopisUrčuje, či je voľba checked zapnutá a ovplyvňuje správanie komponentu.
Atribútchecked
Typboolean
Predvolenéfalse

customErrorDisplay​

PopisRiadi validáciu alebo stavové hlášky pre voľbu custom-error-display.
Atribútcustom-error-display
Typboolean
Predvolenéfalse

disabled​

PopisVypína používateľskú interakciu s komponentom.
Atribútdisabled
Typboolean
Predvolené-

indeterminate​

PopisUrčuje, či je voľba indeterminate zapnutá a ovplyvňuje správanie komponentu.
Atribútindeterminate
Typboolean
Predvolenéfalse

invalid​

PopisRiadi validáciu alebo stavové hlášky pre voľbu invalid.
Atribútinvalid
Typboolean
Predvolenéfalse

label​

PopisNastavuje zobrazený alebo prístupný textový štítok.
Atribútlabel
Typstring
Predvolené-

required​

PopisOznačí komponent ako povinný pre validáciu formulára.
Atribútrequired
Typboolean
Predvolené-

validateOnChange​

PopisUrčuje, či je voľba validate-on-change zapnutá a ovplyvňuje správanie komponentu.
Atribútvalidate-on-change
Typboolean
Predvolenéfalse

value​

PopisNastavuje aktuálnu hodnotu komponentu.
Atribútvalue
Typstring
Predvolenéon

Events​

NázovPopis
wje-toggle:inputVyvolá sa pri zmene vstupnej hodnoty.
wje-toggle:changeVyvolá sa pri zmene hodnoty komponentu.

Methods​

Pre tento komponent nie sú dostupné žiadne verejné metódy.

CSS shadow parts​

NázovPopis
nativeŠtýluje koreňovú shadow časť komponentu.

CSS custom variables​

NázovPopis
--wje-checkbox-border-radiusVlastná CSS premenná, ktorá riadi zaoblenie rohov.
--wje-checkbox-border-widthVlastná CSS premenná, ktorá riadi border width.
--wje-checkbox-border-styleVlastná CSS premenná na štýlovanie komponentu (border style).
--wje-checkbox-border-colorVlastná CSS premenná, ktorá riadi border color.
--wje-checkbox-margin-inlineVlastná CSS premenná, ktorá riadi margin inline.

Slots​

NázovPopis
defaultPredvolený slot pre hlavný obsah komponentu.