Checkbox
Native binary and tri-state controls with separate type-safe models, complete Angular Forms support and consumer-owned visuals.
GET STARTED
Import
Both standalone contracts ship from the granular Checkbox entry point.
Binary model
checked is always boolean. Projected text activates the real native checkbox through its wrapping label.
Tri-state model
The dedicated control cycles false → true → null → false. Null is the single authoritative mixed state.
States
Disabled, readonly, invalid and pending remain distinct so forms and assistive technology receive the correct contract.
Angular Forms
One native contract works with Signal Forms, Reactive Forms and template-driven forms without a legacy value accessor wrapper.
SIGNAL FORMS
true
REACTIVE FORMS
false
NGMODEL
true
Semantic events
stateChange fires only for a user action and includes previous state plus the native event. Programmatic model writes remain silent.
Field composition
Inside Neural Field, Checkbox inherits control id, descriptions, required, invalid, pending, disabled, readonly, fluid and unstyled state.
Additive class ownership
Convenience classes and typed state slots merge with the theme layer; ordinary classes never erase the component appearance.
Unstyled and typed slots
The native input, projected label, state and structural hooks stay intact while all NeuralNg visual classes are removed.
Contract boundaries
Binary
Owns boolean checked state.
Tri-state
Owns boolean or null value.
Application
Owns business validation and persistence.
ACCESSIBILITY
Native behavior first
Checkbox retains browser focus, label activation, validation, form submission and keyboard behavior.
Native semantics
Both controls render a real input[type=checkbox]. No synthetic checkbox role or keyboard emulation is required.
Accessible names
Prefer visible projected label text. Use ariaLabel only when the visual design has no text label.
Keyboard
Tab focuses the native input and Space changes its value. Readonly remains focusable but blocks mutation; disabled is removed from focus.
Mixed state
TriState maps null to the native indeterminate property and aria-checked="mixed". Binary Checkbox also accepts a presentation-only indeterminate input for collection controls while its model remains boolean.
Disabled versus readonly
Disabled prevents focus and native submission. Readonly is an accessible NeuralNg behavior that preserves focus and the current value.
Field state
Descriptions are joined through aria-describedby; invalid, required and pending map to their corresponding ARIA attributes.
PUBLIC API
Checkbox contracts
Canonical symbols are NeuralCheckbox and NeuralTriStateCheckbox. Their value models remain deliberately separate.
Binary inputs
NeuralCheckbox implements FormCheckboxControl and accepts the shared inputs below.
| Input | Type | Default | Purpose |
|---|---|---|---|
| indeterminate (NeuralCheckbox) | boolean | false | Presentation-only mixed state for partial collection selection. |
| disabled | boolean | false | Disables the native input and removes interaction. |
| readonly | boolean | false | Keeps focus while preventing mutation. |
| required | boolean | false | Applies native and accessible required state. |
| invalid | boolean | false | Exposes invalid visual and ARIA state. |
| pending | boolean | false | Exposes aria-busy during validation. |
| touched | boolean | false | Forms/Field state contract. |
| dirty | boolean | false | Forms/Field state contract. |
| fluid | boolean | false | Fills the available inline width. |
| unstyled | boolean | false | Removes all NeuralNg visual classes. |
| inputId | string | '' | Native input id; generated when omitted. |
| name | string | '' | Native form submission name. |
| inputValue | string | 'on' | Native checked submission value. |
| ariaLabel | string | '' | Accessible name when no visible label exists. |
| checkboxClass | string | '' | Additive class on the label root. |
| inputClass | string | '' | Additive class on the native input. |
| labelClass | string | '' | Additive class on projected label text. |
| classes | NeuralCheckboxClasses | NeuralTriStateCheckboxClasses | {} | Typed additive classes for structure and value states. |
Tri-state inputs
NeuralTriStateCheckbox implements FormValueControl<boolean | null>, accepts every shared input, and extends classes with mixedControl.
Models
checkedModelSignal<boolean> · falseBinary value; generates checkedChange.
valueModelSignal<boolean | null> · falseTri-state value; generates valueChange.
Events
checkedChangebooleanGenerated by the binary checked model for two-way binding.
valueChangeboolean | nullGenerated by the tri-state value model for two-way binding.
stateChangeNeuralCheckboxChangeBinary user action with current and previous values.
stateChangeNeuralTriStateCheckboxChangeTri-state user action with current and previous values.
touchvoidNative input lost focus.
Methods
focus(options?: FocusOptions) => voidFocuses the native input.
reset() => voidResets binary or tri-state value to false.
Typed class slots
Binary slots
rootinputcontrolcheckedControllabelTri-state slots
rootinputcontrolcheckedControllabelmixedControlPublic types
NeuralCheckboxChange{ checked, previousChecked, nativeEvent }
NeuralTriStateCheckboxValueboolean | null
NeuralTriStateCheckboxChange{ value, previousValue, nativeEvent }
NeuralCheckboxClasses{ root?, input?, control?, checkedControl?, label? }
NeuralTriStateCheckboxClassesNeuralCheckboxClasses & { mixedControl? }
DESIGN TOKENS
Checkbox tokens
Neutral is the reference layer; Glass, Mist and Futuristic override the same component contract.
Layout and typography
--neural-checkbox-gapSpacing between component items.
--neural-checkbox-widthComponent inline size.
--neural-checkbox-sizeComponent width and height.
--neural-checkbox-control-offsetControl positional offset.
--neural-checkbox-radiusComponent corner radius.
--neural-checkbox-font-familyComponent font family.
--neural-checkbox-font-sizeComponent font size.
--neural-checkbox-line-heightComponent line height.
Color and state
--neural-checkbox-backgroundComponent background surface.
--neural-checkbox-background-hoverHovered component background surface.
--neural-checkbox-background-checkedChecked component background surface.
--neural-checkbox-borderComponent border shorthand.
--neural-checkbox-border-color-hoverHovered component border color.
--neural-checkbox-border-color-focusFocused component border color.
--neural-checkbox-border-color-checkedChecked component border color.
--neural-checkbox-border-color-invalidInvalid component border color.
--neural-checkbox-mark-colorMark foreground color.
--neural-checkbox-label-colorLabel foreground color.
--neural-checkbox-shadowComponent box shadow.
--neural-checkbox-shadow-focusFocused component box shadow.
--neural-checkbox-focus-ringComponent keyboard focus ring.
--neural-checkbox-focus-ring-offsetComponent focus ring offset.
--neural-checkbox-disabled-opacityDisabled opacity.
Motion
--neural-checkbox-transitionComponent CSS transition.
--neural-checkbox-mark-transitionMark CSS transition.
Reduced-motion preferences collapse transitions automatically.