NEURALNG

PUBLIC CONTRACT

Switch API

Models and inputs

NameTypeDefaultPurpose
checkedmodel<boolean>false Authoritative binary value; checkedChange supports two-way binding.
disabledbooleanfalse Disables the native checkbox.
readonlybooleanfalse Keeps focusability while preventing user mutation.
requiredbooleanfalse Enables native required validation.
invalidbooleanfalse Exposes ARIA and visual invalid state.
pendingbooleanfalse Exposes aria-busy on the input.
touched / dirtybooleanfalse Forms state inputs retained for adapter parity.
fluidbooleanfalse Expands the root to available width.
inputIdstring'' Explicit native input id.
namestring'' Native form submission name.
inputValuestring'on' Native value submitted when checked.
ariaLabelstring'' Accessible name when no visible label is projected.
onLabel / offLabelstring'' Optional visual state text inside the track.
unstyledbooleanfalse Removes NeuralNg visual classes.
switchClassstring'' Additive root classes.
inputClassstring'' Additive native input classes.
labelClassstring'' Additive projected label classes.
classesNeuralSwitchClasses{} Typed visual class slots.

Outputs

checkedChangeboolean

Generated by the checked model for two-way binding.

stateChangeNeuralSwitchChange

User-only event with current value, previous value and native event.

touchvoid

Emitted when the native input blurs.

Methods

focus(options?)void

Focuses the native checkbox.

reset()void

Sets checked to false without a user event.

Typed class slots

root

Label wrapper and state-hook owner.

input

Visually hidden native checkbox.

track

Visible switch track.

checkedTrack

Additional track classes while checked.

thumb

Movable visual thumb.

label

Projected visible label.

onLabel

Checked-state track text.

offLabel

Unchecked-state track text.

Public types

NeuralSwitchChange

{ checked: boolean; previousChecked: boolean; nativeEvent: Event }

NeuralSwitchClasses

Typed root, native input, track, thumb, label and state-label slots.

Legacy alias

SwitchComponent remains importable for compatibility, but new code and generated AI context should always use NeuralSwitch.