MCPcopy Index your code
hub / github.com/angular/components / MatTooltip

Class MatTooltip

src/material/tooltip/tooltip.ts:194–952  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192 },
193})
194export class MatTooltip implements OnDestroy, AfterViewInit {
195 private _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);
196 private _ngZone = inject(NgZone);
197 private _platform = inject(Platform);
198 private _ariaDescriber = inject(AriaDescriber);
199 private _focusMonitor = inject(FocusMonitor);
200 protected _dir = inject(Directionality);
201 private _injector = inject(Injector);
202 private _viewContainerRef = inject(ViewContainerRef);
203 private _mediaMatcher = inject(MediaMatcher);
204 private _document = inject(DOCUMENT);
205 private _renderer = inject(Renderer2);
206 private _animationsDisabled = _animationsDisabled();
207 private _defaultOptions = inject<MatTooltipDefaultOptions>(MAT_TOOLTIP_DEFAULT_OPTIONS, {
208 optional: true,
209 });
210
211 _overlayRef: OverlayRef | null = null;
212 _tooltipInstance: TooltipComponent | null = null;
213 _overlayPanelClass: string[] | undefined; // Used for styling internally.
214
215 private _portal!: ComponentPortal<TooltipComponent>;
216 private _position: TooltipPosition = 'below';
217 private _positionAtOrigin: boolean = false;
218 private _disabled: boolean = false;
219 private _tooltipClass!: string | string[] | Set<string> | {[key: string]: unknown};
220 private _viewInitialized = false;
221 private _pointerExitEventsInitialized = false;
222 private readonly _tooltipComponent = TooltipComponent;
223 private _viewportMargin = 8;
224 private _currentPosition!: TooltipPosition;
225 private readonly _cssClassPrefix: string = 'mat-mdc';
226 private _ariaDescriptionPending = false;
227 private _dirSubscribed = false;
228
229 /** Allows the user to define the position of the tooltip relative to the parent element */
230 @Input('matTooltipPosition')
231 get position(): TooltipPosition {
232 return this._position;
233 }
234
235 set position(value: TooltipPosition) {
236 if (value !== this._position) {
237 this._position = value;
238
239 if (this._overlayRef) {
240 this._updatePosition(this._overlayRef);
241 this._tooltipInstance?.show(0);
242 this._overlayRef.updatePosition();
243 }
244 }
245 }
246
247 /**
248 * Whether tooltip should be relative to the click or touch origin
249 * instead of outside the element bounding box.
250 */
251 @Input('matTooltipPositionAtOrigin')

Callers

nothing calls this directly

Calls 3

_isTooltipVisibleMethod · 0.95
_animationsDisabledFunction · 0.90
hasModifierKeyFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…