Skip to content

Commit fe10ed8

Browse files
crisbetommalerba
authored andcommitted
docs(material/button-toggle): add missing type on public API (#22224)
Adds an explicit type to `MatButtonToggleGroup` so that it can show up in the docs. This change is merge safe, because the type is the same as the inferred type that was in place already. Fixes #22026. (cherry picked from commit 9f560f4)
1 parent 97bad00 commit fe10ed8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/material/button-toggle/button-toggle.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ export const MAT_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR: any = {
8383
multi: true
8484
};
8585

86-
let _uniqueIdCounter = 0;
86+
// Counter used to generate unique IDs.
87+
let uniqueIdCounter = 0;
8788

8889
/** Change event object emitted by MatButtonToggle. */
8990
export class MatButtonToggleChange {
@@ -157,7 +158,7 @@ export class MatButtonToggleGroup implements ControlValueAccessor, OnInit, After
157158
});
158159
}
159160
}
160-
private _name = `mat-button-toggle-group-${_uniqueIdCounter++}`;
161+
private _name = `mat-button-toggle-group-${uniqueIdCounter++}`;
161162

162163
/** Whether the toggle group is vertical. */
163164
@Input()
@@ -190,7 +191,7 @@ export class MatButtonToggleGroup implements ControlValueAccessor, OnInit, After
190191
@Output() readonly valueChange = new EventEmitter<any>();
191192

192193
/** Selected button toggles in the group. */
193-
get selected() {
194+
get selected(): MatButtonToggle | MatButtonToggle[] {
194195
const selected = this._selectionModel ? this._selectionModel.selected : [];
195196
return this.multiple ? selected : (selected[0] || null);
196197
}
@@ -424,6 +425,7 @@ export class MatButtonToggle extends _MatButtonToggleMixinBase implements OnInit
424425
*/
425426
@Input('aria-labelledby') ariaLabelledby: string | null = null;
426427

428+
/** Underlying native `button` element. */
427429
@ViewChild('button') _buttonElement: ElementRef<HTMLButtonElement>;
428430

429431
/** The parent button toggle group (exclusive selection). Optional. */
@@ -504,7 +506,7 @@ export class MatButtonToggle extends _MatButtonToggleMixinBase implements OnInit
504506
ngOnInit() {
505507
const group = this.buttonToggleGroup;
506508
this._isSingleSelector = group && !group.multiple;
507-
this.id = this.id || `mat-button-toggle-${_uniqueIdCounter++}`;
509+
this.id = this.id || `mat-button-toggle-${uniqueIdCounter++}`;
508510

509511
if (this._isSingleSelector) {
510512
this.name = group.name;

0 commit comments

Comments
 (0)