|
| 1 | +<div class="example-radio-controls"> |
| 2 | + <mat-checkbox [formControl]="disabled">Disabled</mat-checkbox> |
| 3 | + <mat-checkbox [formControl]="readonly">Readonly</mat-checkbox> |
| 4 | + <mat-checkbox [formControl]="skipDisabled">Skip Disabled</mat-checkbox> |
| 5 | + |
| 6 | + <mat-form-field subscriptSizing="dynamic" appearance="outline"> |
| 7 | + <mat-label>Selected Flavor</mat-label> |
| 8 | + <mat-select [(value)]="selectedValue"> |
| 9 | + <mat-option [value]="null"><em>None</em></mat-option> |
| 10 | + @for (flavor of flavors; track flavor) { |
| 11 | + <mat-option [value]="flavor">{{flavor}}</mat-option> |
| 12 | + } |
| 13 | + </mat-select> |
| 14 | + </mat-form-field> |
| 15 | + |
| 16 | + <mat-form-field subscriptSizing="dynamic" appearance="outline"> |
| 17 | + <mat-label>Disabled Radio Options</mat-label> |
| 18 | + <mat-select [(value)]="disabledOptions" multiple> |
| 19 | + @for (flavor of flavors; track flavor) { |
| 20 | + <mat-option [value]="flavor">{{flavor}}</mat-option> |
| 21 | + } |
| 22 | + </mat-select> |
| 23 | + </mat-form-field> |
| 24 | + |
| 25 | + <mat-form-field subscriptSizing="dynamic" appearance="outline"> |
| 26 | + <mat-label>Orientation</mat-label> |
| 27 | + <mat-select [(value)]="orientation"> |
| 28 | + <mat-option value="vertical">Vertical</mat-option> |
| 29 | + <mat-option value="horizontal">Horizontal</mat-option> |
| 30 | + </mat-select> |
| 31 | + </mat-form-field> |
| 32 | + |
| 33 | + <mat-form-field subscriptSizing="dynamic" appearance="outline"> |
| 34 | + <mat-label>Focus strategy</mat-label> |
| 35 | + <mat-select [(value)]="focusMode"> |
| 36 | + <mat-option value="roving">Roving Tabindex</mat-option> |
| 37 | + <mat-option value="activedescendant">Active Descendant</mat-option> |
| 38 | + </mat-select> |
| 39 | + </mat-form-field> |
| 40 | +</div> |
| 41 | + |
| 42 | +<!-- #docregion radio-group --> |
| 43 | +<ul |
| 44 | + cdkRadioGroup |
| 45 | + [(value)]="selectedValue" |
| 46 | + [disabled]="disabled.value" |
| 47 | + [readonly]="readonly.value" |
| 48 | + [skipDisabled]="skipDisabled.value" |
| 49 | + [orientation]="orientation" |
| 50 | + [focusMode]="focusMode" |
| 51 | + class="example-radio-group" |
| 52 | + aria-label="Select your favorite ice cream flavor" |
| 53 | +> |
| 54 | + @for (flavor of flavors; track flavor) { |
| 55 | + @let optionDisabled = disabledOptions.includes(flavor); |
| 56 | + <li cdkRadioButton [value]="flavor" [disabled]="optionDisabled" class="example-radio-button"> |
| 57 | + <span class="example-radio-indicator"></span> |
| 58 | + <span>{{ flavor }}</span> |
| 59 | + </li> |
| 60 | + } |
| 61 | +</ul> |
| 62 | +<!-- #enddocregion radio-group --> |
0 commit comments