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

Class MatTimepickerToggle

src/material/timepicker/timepicker-toggle.ts:40–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38 imports: [MatIconButton],
39})
40export class MatTimepickerToggle<D> {
41 private _defaultConfig = inject(MAT_TIMEPICKER_CONFIG, {optional: true});
42 private _defaultTabIndex = (() => {
43 const value = inject(new HostAttributeToken('tabindex'), {optional: true});
44 const parsed = Number(value);
45 return isNaN(parsed) ? null : parsed;
46 })();
47
48 protected _isDisabled = computed(() => {
49 const timepicker = this.timepicker();
50 return this.disabled() || timepicker.disabled();
51 });
52
53 /** Timepicker instance that the button will toggle. */
54 readonly timepicker: InputSignal<MatTimepicker<D>> = input.required<MatTimepicker<D>>({
55 alias: 'for',
56 });
57
58 /** Screen-reader label for the button. */
59 readonly ariaLabel = input<string | undefined>(undefined, {
60 alias: 'aria-label',
61 });
62
63 /** Screen-reader labelled by id for the button. */
64 readonly ariaLabelledby = input<string | undefined>(undefined, {
65 alias: 'aria-labelledby',
66 });
67
68 /** Default aria-label for the toggle if none is provided. */
69 private readonly _defaultAriaLabel = 'Open timepicker options';
70
71 /** Whether the toggle button is disabled. */
72 readonly disabled: InputSignalWithTransform<boolean, unknown> = input(false, {
73 transform: booleanAttribute,
74 alias: 'disabled',
75 });
76
77 /** Tabindex for the toggle. */
78 readonly tabIndex: InputSignal<number | null> = input(this._defaultTabIndex);
79
80 /** Whether ripples on the toggle should be disabled. */
81 readonly disableRipple: InputSignalWithTransform<boolean, unknown> = input(
82 this._defaultConfig?.disableRipple ?? false,
83 {transform: booleanAttribute},
84 );
85
86 /** Opens the connected timepicker. */
87 protected _open(event: Event): void {
88 if (this.timepicker() && !this._isDisabled()) {
89 this.timepicker().open();
90 event.stopPropagation();
91 }
92 }
93
94 /**
95 * Checks for ariaLabelledby and if empty uses custom
96 * aria-label or defaultAriaLabel if neither is provided.
97 */

Callers

nothing calls this directly

Calls 4

computedFunction · 0.85
inputFunction · 0.85
disabledMethod · 0.45
requiredMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…