averouiComponent playgroundv0.0.1

Switch

New

Turn a setting on or off with a smooth, accessible toggle.

Boolean valueKeyboard accessibleChange event

Overview

Click the label or switch, or focus it and press Space.

No change event yet.

HTMLValue and events
<av-switch label="Email notifications"
  [(ngModel)]="notifications" (onChange)="changed($event)" />

Sizes

Reactive forms

Programmatic changes, reset and disabled state follow the form control.

States

Usage and API

Import AvSwitch with FormsModule or ReactiveFormsModule.

TYPESCRIPTChange handler
import { AvSwitch, AvSwitchChangeEvent } from 'avero-ui';

changed(event: AvSwitchChangeEvent): void {
  this.notificationsEnabled = event.checked;
}
Events.onChange emits { checked, originalEvent } for user changes. Programmatic writes and resets do not emit this output.
Theme. Customize --av-switch-accent, --av-switch-background, --av-switch-thumb and --av-switch-focus.
Avero UI Designed to fit your application.