DaffSwitchComponent
The switch component provides a way to toggle between two settings.
Selector:'daff-switch'
Properties
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
| @Input() disabled | any | Whether the switch is disabled and/or loading. | disabledAttribute | |||||
| ariaDisabled | ||||||||
| classes | ||||||||
| @Input() loading | false | Whether the switch is loading. | ||||||
| @Input() checked | false | Current state of switch (on/off). | ||||||
| @Input() labelPosition | DaffLabelPosition | The position of the label relative to the switch. Defaults to 'daff-left'. | ||||||
| @Input() error | false | Whether the switch shows an error. | _disabled | false | ||||
| handleKeydown | ||||||||
| @Input() ariaLabel | '' | aria-label for the switch. | ||||||
| @Input() id | string | @Output() toggled | EventEmitter<boolean> | onToggle |
Examples
```html
<daff-switch [checked]="checked" loading="loading" [error]="true" [labelPosition]="top">
Label