Checkbox
Native checkbox styling with field ARIA wiring and invalid state integration.
Use the directive on native checkbox inputs and pair it with kui-field for label, hint, and error wiring.
import { KuiCheckboxDirective, KuiFieldComponent } from '@kikita-labs/ui';Keep a native label around the checkbox for option text.
<kui-field label="Notifications" hint="Control product and release emails">
<label class="checkbox-option">
<input kuiCheckbox type="checkbox" [checked]="receiveUpdates()" />
<span>Receive updates</span>
</label>
</kui-field>Match checkbox size to surrounding field density and text scale; disabled and invalid follow native and field-driven state.
<div class="checkbox-size-example">
<label class="checkbox-option">
<input kuiCheckbox type="checkbox" size="xs" />
<span>Extra small</span>
</label>
<label class="checkbox-option">
<input kuiCheckbox type="checkbox" size="sm" checked />
<span>Small</span>
</label>
<label class="checkbox-option">
<input kuiCheckbox type="checkbox" size="md" checked />
<span>Medium</span>
</label>
<label class="checkbox-option">
<input kuiCheckbox type="checkbox" size="lg" />
<span>Large</span>
</label>
<label class="checkbox-option">
<input kuiCheckbox type="checkbox" disabled />
<span>Disabled</span>
</label>
<label class="checkbox-option">
<input kuiCheckbox type="checkbox" disabled checked />
<span>Disabled and checked</span>
</label>
<label class="checkbox-option">
<input kuiCheckbox type="checkbox" invalid />
<span>Invalid</span>
</label>
</div>Inputs verified against @kikita-labs/ui v1.6.1 public typings.
| Name | Type | Default | Description |
|---|---|---|---|
| size | 'xs' | 'sm' | 'md' | 'lg' | 'md' | Checkbox size mapped to Kikita checkbox tokens. |
| invalid | boolean | false | Marks the checkbox invalid outside a field error state. |
| id | string | undefined | - | Explicit id override. Inside kui-field, the field id is used when omitted. |
| checked | boolean | false | Native checked state. Not a directive input; bind it directly on the input element. |
| disabled | boolean | false | Native disabled state. Not a directive input; bind it directly on the input element. |
| indeterminate | boolean | false | Native DOM property, not an HTML attribute or directive input. Set it imperatively on the element to show the dash-mark state; .kui-checkbox styles :indeterminate. |
Checkbox keeps native input semantics and adds field-described state when used inside kui-field.
- Use a native
labelfor the checkbox option text. - Use
kui-fieldfor group label, hint, error, and described-by wiring. - Use native checked and disabled states; do not replace the input with a custom role.
- Use
invalidonly when the checkbox is outside a field error state. .kui-checkboxstyles the native:indeterminatepseudo-class (a dash mark instead of a checkmark).indeterminateis a DOM property, not an HTML attribute, so set it imperatively on the element.