Skip to main content
NeuralUIv1.14.3New
GitHub
Component

Switch

Animated toggle compatible with Angular Forms. Ideal for enabling/disabling options.

TypeScript
import { NeuSwitchComponent } from '@neural-ui/core/switch';
TypeScript
import { FormControl, ReactiveFormsModule } from '@angular/forms';
import { NeuSwitchComponent } from '@neural-ui/core/switch';

@Component({
  imports: [NeuSwitchComponent, ReactiveFormsModule],
  template: `
    <neu-switch label="Notificaciones" [formControl]="notifCtrl" />
    <neu-switch label="Modo oscuro" [disabled]="true" />

    <!-- Reactive Forms / Reactive Forms -->
    <neu-switch label="Newsletter" [formControl]="newsletterCtrl" />
  `
})
export class MyComponent {
  readonly notifCtrl = new FormControl(false, { nonNullable: true });
  readonly newsletterCtrl = new FormControl(false, { nonNullable: true });
}