|
1 | 1 | <h1>Basic Example</h1> |
2 | 2 | <section class="demo-section"> |
3 | | - <mat-radio-button name="group1">Option 1</mat-radio-button> |
| 3 | + <mat-radio-button name="group1" checked>Option 1</mat-radio-button> |
4 | 4 | <mat-radio-button name="group1">Option 2</mat-radio-button> |
5 | | - <mat-radio-button name="group1" disabled>Option 3 (Disabled)</mat-radio-button> |
| 5 | + <mat-radio-button name="group1" disabled="true">Option 3 (disabled)</mat-radio-button> |
| 6 | +</section> |
| 7 | + |
| 8 | +<h1>Color Example</h1> |
| 9 | +<section class="demo-section"> |
| 10 | + <mat-radio-button name="group2">Default (accent)</mat-radio-button> |
| 11 | + <mat-radio-button name="group2" color="primary">Primary</mat-radio-button> |
| 12 | + <mat-radio-button name="group2" color="accent">Accent</mat-radio-button> |
| 13 | + <mat-radio-button name="group2" color="warn">Warn</mat-radio-button> |
| 14 | +</section> |
| 15 | + |
| 16 | +<h1>Group Color Example</h1> |
| 17 | +<section class="demo-section"> |
| 18 | + <mat-radio-group color="warn"> |
| 19 | + <mat-radio-button name="group3" value="1">Option 1</mat-radio-button> |
| 20 | + <mat-radio-button name="group3" value="2">Option 2</mat-radio-button> |
| 21 | + <mat-radio-button name="group3" value="3">Option 3</mat-radio-button> |
| 22 | + <mat-radio-button name="group3" value="4" color="primary">Option with color override</mat-radio-button> |
| 23 | + </mat-radio-group> |
| 24 | +</section> |
| 25 | + |
| 26 | +<h1>Dynamic Example</h1> |
| 27 | +<section class="demo-section"> |
| 28 | + <div> |
| 29 | + <span>isDisabled: {{isDisabled}}</span> |
| 30 | + <button mat-raised-button (click)="isDisabled=!isDisabled" class="demo-button"> |
| 31 | + Disable buttons |
| 32 | + </button> |
| 33 | + </div> |
| 34 | + <div> |
| 35 | + <span>isRequired: {{isRequired}}</span> |
| 36 | + <button mat-raised-button (click)="isRequired=!isRequired" class="demo-button"> |
| 37 | + Require buttons |
| 38 | + </button> |
| 39 | + </div> |
| 40 | + <div> |
| 41 | + <span><mat-checkbox [(ngModel)]="isAlignEnd">Align end</mat-checkbox></span> |
| 42 | + </div> |
| 43 | + <mat-radio-group |
| 44 | + name="my_options" |
| 45 | + [disabled]="isDisabled" |
| 46 | + [required]="isRequired" |
| 47 | + [labelPosition]="isAlignEnd ? 'after' : 'before'"> |
| 48 | + <mat-radio-button value="option_1">Option 1</mat-radio-button> |
| 49 | + <mat-radio-button value="option_2">Option 2</mat-radio-button> |
| 50 | + <mat-radio-button value="option_3">Option 3</mat-radio-button> |
| 51 | + </mat-radio-group> |
| 52 | +</section> |
| 53 | + |
| 54 | +<h1>Favorite Season Example</h1> |
| 55 | +<h2>Dynamic Example with two-way data-binding</h2> |
| 56 | +<section class="demo-section"> |
| 57 | + <mat-radio-group name="more_options" [(ngModel)]="favoriteSeason"> |
| 58 | + <mat-radio-button *ngFor="let season of seasonOptions" name="more_options" [value]="season"> |
| 59 | + {{season}} |
| 60 | + </mat-radio-button> |
| 61 | + </mat-radio-group> |
| 62 | + <p>Your favorite season is: {{favoriteSeason}}</p> |
6 | 63 | </section> |
0 commit comments