MCPcopy Create free account
hub / github.com/angular/components / MatChip

Class MatChip

src/material/chips/chip.ts:104–445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102 imports: [MatChipContent],
103})
104export class MatChip implements OnInit, AfterViewInit, AfterContentInit, DoCheck, OnDestroy {
105 _changeDetectorRef = inject(ChangeDetectorRef);
106 _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);
107 private readonly _tagName = inject(HOST_TAG_NAME);
108 protected _ngZone = inject(NgZone);
109 private _focusMonitor = inject(FocusMonitor);
110 private _globalRippleOptions = inject<RippleGlobalOptions>(MAT_RIPPLE_GLOBAL_OPTIONS, {
111 optional: true,
112 });
113
114 protected _document = inject(DOCUMENT);
115
116 /** Emits when the chip is focused. */
117 readonly _onFocus = new Subject<MatChipEvent>();
118
119 /** Emits when the chip is blurred. */
120 readonly _onBlur = new Subject<MatChipEvent>();
121
122 /** Whether this chip is a basic (unstyled) chip. */
123 _isBasicChip = false;
124
125 /** Role for the root of the chip. */
126 @Input() role: string | null = null;
127
128 /** Whether the chip has focus. */
129 private _hasFocusInternal = false;
130
131 /** Whether moving focus into the chip is pending. */
132 private _pendingFocus: boolean = false;
133
134 /** Subscription to changes in the chip's actions. */
135 private _actionChanges: Subscription | undefined;
136
137 /** Whether animations for the chip are enabled. */
138 _animationsDisabled = _animationsDisabled();
139
140 /** All avatars present in the chip. */
141 @ContentChildren(MAT_CHIP_AVATAR, {descendants: true})
142 protected _allAvatars!: QueryList<MatChipAvatar>;
143
144 /** All leading icons present in the chip. */
145 @ContentChildren(MAT_CHIP_LEADING_ICON, {descendants: true})
146 protected _allLeadingIcons!: QueryList<MatChipLeadingIcon>;
147
148 /** All trailing icons present in the chip. */
149 @ContentChildren(MAT_CHIP_TRAILING_ICON, {descendants: true})
150 protected _allTrailingIcons!: QueryList<MatChipTrailingIcon>;
151
152 /** All edit icons present in the chip. */
153 @ContentChildren(MAT_CHIP_EDIT, {descendants: true})
154 protected _allEditIcons!: QueryList<MatChipEdit>;
155
156 /** All remove icons present in the chip. */
157 @ContentChildren(MAT_CHIP_REMOVE, {descendants: true})
158 protected _allRemoveIcons!: QueryList<MatChipRemove>;
159
160 _hasFocus() {
161 return this._hasFocusInternal;

Callers

nothing calls this directly

Calls 2

_animationsDisabledFunction · 0.90
getIdMethod · 0.45

Tested by

no test coverage detected