Skip to content

Commit

Permalink
docs(material/slide-toggle): add examples with labelPosition="before" (
Browse files Browse the repository at this point in the history
…angular#28899)

Add examples of using the slide toggle with labelPosition="before". This
renders the label before the toggle button.

Allow testing of issues when label is before the toggle button (angular#26880).

Relates to angular#26880
  • Loading branch information
zarend committed Apr 18, 2024
1 parent 9b2e9b7 commit fca6d7a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<mat-slide-toggle>Slide me!</mat-slide-toggle>
<p><mat-slide-toggle>Slide me!</mat-slide-toggle></p>
<p><mat-slide-toggle labelPosition="before">...and slide me too!</mat-slide-toggle></p>
7 changes: 7 additions & 0 deletions src/dev-app/slide-toggle/slide-toggle-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
<mat-slide-toggle [disabled]="firstToggle">Disable Bound</mat-slide-toggle>
<mat-slide-toggle hideIcon [(ngModel)]="firstToggle">No icon</mat-slide-toggle>

<p>With label before the slide toggle.</p>

<mat-slide-toggle labelPosition="before" color="primary" [(ngModel)]="firstToggle">Default Slide Toggle</mat-slide-toggle>
<mat-slide-toggle labelPosition="before" [(ngModel)]="firstToggle" disabled>Disabled Slide Toggle</mat-slide-toggle>
<mat-slide-toggle labelPosition="before" [disabled]="firstToggle">Disable Bound</mat-slide-toggle>
<mat-slide-toggle labelPosition="before" hideIcon [(ngModel)]="firstToggle">No icon</mat-slide-toggle>

<p>Example where the slide toggle is required inside of a form.</p>

<form #form="ngForm" (ngSubmit)="onFormSubmit()">
Expand Down

0 comments on commit fca6d7a

Please sign in to comment.