Skip to content

Switch

<ax-switch> is a boolean toggle styled as a sliding pill. Use Switch for “this feature is on/off” and Checkbox for “yes/no, I agree” options. It implements ControlValueAccessor with two-way [(checked)].

import { AxSwitchComponent } from '@axisui-ng/forms';
<ax-switch [(checked)]="notifications" ariaLabel="Enable notifications">
Notifications
</ax-switch>
InputTypeDefaultNotes
checkedmodel<boolean>falseTwo-way on/off state ([(checked)]); also CVA.
disabledbooleanfalseDisabled (also via CVA setDisabledState).
ariaLabelstring | nullnullAccessible label when there’s no visible projected label.
describedBystring | nullnullaria-describedby.

Default content is projected as the visible label next to the control (inside the wrapping <label>).

Renders a native checkbox with role="switch" and aria-checked. Keyboard (Space) toggles. Provide projected label text or ariaLabel.

Interactive examples live in Storybook under Forms / Switch. Run pnpm storybook to explore them.