Switch
Switch
Section titled “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
Section titled “Import”import { AxSwitchComponent } from '@axisui-ng/forms';<ax-switch [(checked)]="notifications" ariaLabel="Enable notifications"> Notifications</ax-switch>Inputs & models
Section titled “Inputs & models”| Input | Type | Default | Notes |
|---|---|---|---|
checked | model<boolean> | false | Two-way on/off state ([(checked)]); also CVA. |
disabled | boolean | false | Disabled (also via CVA setDisabledState). |
ariaLabel | string | null | null | Accessible label when there’s no visible projected label. |
describedBy | string | null | null | aria-describedby. |
Default content is projected as the visible label next to the control (inside the wrapping <label>).
Accessibility
Section titled “Accessibility”Renders a native checkbox with role="switch" and aria-checked. Keyboard (Space) toggles. Provide
projected label text or ariaLabel.
Storybook
Section titled “Storybook”Interactive examples live in Storybook under Forms / Switch. Run pnpm storybook to explore them.