NEURALNG
FORMSBETA

Switch

A native binary control with switch semantics, three Angular Forms adapters, deterministic readonly behavior and complete visual ownership.

Native checkboxForms readyRTL safe

GET STARTED

Import

Import the canonical standalone component from its granular entry point.

app.ts TypeScript
import { NeuralSwitch } from '@neural-ng/core/switch';

@Component({ imports: [NeuralSwitch] })

Binary state

Bind the boolean checked model directly. The projected text labels the native switch and remains clickable.

On and off labels

Optional track labels reinforce state visually. They are decorative, so ariaLabel supplies the accessible name when no visible label is projected.

Every Angular Forms API

Signal Forms, Reactive Forms and template-driven forms share one boolean source of truth.

States and Field composition

Disabled leaves the tab order, readonly remains discoverable without hover feedback, and NeuralField supplies shared validation state.

You can change this later.Consent is required.

Semantic events

stateChange fires only for user interaction and includes both values. Programmatic writes only update checkedChange.

No user change yet.

Logical RTL behavior

The thumb travels toward logical end, so the same component mirrors without separate application code.

Unstyled and typed slots

Native behavior and structural state hooks remain while Tailwind owns every visible choice.

Component boundary

Switch intentionally models only boolean state. Use Checkbox for form choices and TriState Checkbox when null or mixed is part of the domain.