@engie-group/fluid-design-system-angular
Version:
Fluid Design System Angular
31 lines (28 loc) • 920 B
HTML
<div class="nj-toggle" [ngClass]="[getToggleSizeClass(), getToggleIsDisabledClass(), getToggleInheritColorClass()]">
<label [attr.for]="inputId">
<input
type="checkbox"
role="switch"
#input
[required]="required"
[checked]="isChecked"
[disabled]="isDisabled"
[attr.id]="inputId"
[attr.name]="name"
[attr.aria-label]="ariaLabel"
[attr.aria-labelledby]="ariaLabelledby"
(change)="_onChangeEvent($event)"
(click)="_onInputClick($event)"
/>
<span class="nj-toggle__track"></span>
<div class="nj-toggle__icon-container" #iconWrapper>
<ng-content select="[njToggleIcon]"></ng-content>
</div>
<span *ngIf="hasIcon; else content" class="nj-sr-only">
<ng-container [ngTemplateOutlet]="content"></ng-container>
</span>
<ng-template #content>
<ng-content></ng-content>
</ng-template>
</label>
</div>