MCPcopy Create free account
hub / github.com/ionic-team/ionic-framework / Input

Class Input

core/src/components/input/input.tsx:46–972  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44 scoped: true,
45})
46export class Input implements ComponentInterface {
47 private nativeInput?: HTMLInputElement;
48 private inputId = `ion-input-${inputIds++}`;
49 private helperTextId = `${this.inputId}-helper-text`;
50 private errorTextId = `${this.inputId}-error-text`;
51 private labelTextId = `${this.inputId}-label`;
52 private inheritedAttributes: Attributes = {};
53 private isComposing = false;
54 private slotMutationController?: SlotMutationController;
55 private notchController?: NotchController;
56 private notchSpacerEl: HTMLElement | undefined;
57
58 private originalIonInput?: EventEmitter<InputInputEventDetail>;
59
60 /**
61 * `true` if the input was cleared as a result of the user typing
62 * with `clearOnEdit` enabled.
63 *
64 * Resets when the input loses focus.
65 */
66 private didInputClearOnEdit = false;
67
68 /**
69 * The value of the input when the input is focused.
70 */
71 private focusedValue?: string | number | null;
72
73 /**
74 * The `hasFocus` state ensures the focus class is
75 * added regardless of how the element is focused.
76 * The `ion-focused` class only applies when focused
77 * via tabbing, not by clicking.
78 * The `has-focus` logic was added to ensure the class
79 * is applied in both cases.
80 */
81 @State() hasFocus = false;
82
83 /**
84 * Track validation state for proper aria-live announcements
85 */
86 @State() isInvalid = false;
87
88 @Element() el!: HTMLIonInputElement;
89
90 private validationObserver?: MutationObserver;
91
92 /**
93 * The color to use from your application's color palette.
94 * Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`.
95 * For more information on colors, see [theming](/docs/theming/basics).
96 */
97 @Prop({ reflect: true }) color?: Color;
98
99 /**
100 * Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.
101 * Available options: `"off"`, `"none"`, `"on"`, `"sentences"`, `"words"`, `"characters"`.
102 */
103 @Prop() autocapitalize = 'off';

Calls 4

emitInputChangeMethod · 0.95
emitValueChangeMethod · 0.95
checkClearOnEditMethod · 0.95
setFocusMethod · 0.95

Tested by

no test coverage detected