A highly customizable single-line text field for entering and editing data, with support for prefix/suffix content, helper text, form integration, and built-in validation.
- Element
-
igc-input
- Slots
-
prefix— Renders content before the input. -
suffix— Renders content after input. -
helper-text— Renders content below the input. -
value-missing— Renders content when the required validation fails. -
type-mismatch— Renders content when the a type url/email input pattern validation fails. -
pattern-mismatch— Renders content when the pattern validation fails. -
too-long— Renders content when the maxlength validation fails. -
too-short— Renders content when the minlength validation fails. -
range-overflow— Renders content when the max validation fails. -
range-underflow— Renders content when the min validation fails. -
step-mismatch— Renders content when the step validation fails. -
custom-error— Renders content when setCustomValidity(message) is set. -
invalid— Renders content when the component is in invalid state (validity.valid = false).
- CSS Parts
-
container— The main wrapper that holds all main input elements. -
input— The native input element. -
label— The native label element. -
prefix— The prefix wrapper. -
suffix— The suffix wrapper. -
helper-text— The helper text wrapper.
Properties
Section titled "Properties"autocomplete
Section titled "autocomplete"A hint for the browser on how to autofill the control.
autocomplete: string Defined in src/components/input/input.ts:204
autofocus
Section titled "autofocus"Whether the control should receive focus automatically.
autofocus: boolean Defined in src/components/input/input.ts:197
disabled
Section titled "disabled"Inherited from: IgcInputBaseComponent
The disabled state of the component.
disabled: boolean Defined in src/internals/mixins/forms/types.ts:30
inputMode
Section titled "inputMode"A hint to the browser for which virtual keyboard layout to display. See relevant MDN article
inputMode: string Defined in src/components/input/input.ts:142
invalid
Section titled "invalid"Inherited from: IgcInputBaseComponent
Sets the control into invalid state (visual state only).
invalid: boolean Defined in src/internals/mixins/forms/types.ts:37
label
Section titled "label"Inherited from: IgcInputBaseComponent
The label for the control.
label: string Defined in src/components/input/input-base.ts:85
Optional max
Section titled "max"The maximum value the control accepts.
max: number = undefined Defined in src/components/input/input.ts:182
Optional maxLength
Section titled "maxLength"The maximum string length of the control.
maxLength: number = undefined Defined in src/components/input/input.ts:166
Optional min
Section titled "min"The minimum value the control accepts.
min: number = undefined Defined in src/components/input/input.ts:174
Optional minLength
Section titled "minLength"The minimum string length required by the control.
minLength: number = undefined Defined in src/components/input/input.ts:158
Inherited from: IgcInputBaseComponent
The name of the control, submitted with the form data.
name: string Defined in src/internals/mixins/forms/types.ts:43
outlined
Section titled "outlined"Inherited from: IgcInputBaseComponent
Whether the control will have outlined appearance.
outlined: boolean = false Defined in src/components/input/input-base.ts:71
Optional pattern
Section titled "pattern"The regular expression the value is validated against.
pattern: string = undefined Defined in src/components/input/input.ts:150
placeholder
Section titled "placeholder"Inherited from: IgcInputBaseComponent
The placeholder text of the control.
placeholder: string Defined in src/components/input/input-base.ts:78
readOnly
Section titled "readOnly"Makes the control a readonly field.
readOnly: boolean = false Defined in src/components/input/input.ts:134
Optional step
Section titled "step"The granularity the value must adhere to.
step: number = undefined Defined in src/components/input/input.ts:190
validateOnly
Section titled "validateOnly"Enables validation rules to be evaluated without restricting user input. This applies to the maxLength property for
string-type inputs or allows spin buttons to exceed the predefined min/max limits for number-type inputs.
validateOnly: boolean = false Defined in src/components/input/input.ts:214
Accessors
Section titled "Accessors"defaultValue
Section titled "defaultValue"Inherited from: IgcInputBaseComponent
get defaultValue(): any Defined in src/internals/mixins/forms/types.ts:182
The initial value of the component.
set defaultValue(value: unknown): void Defined in src/internals/mixins/forms/types.ts:182
Parameters
- value:
unknown
Returns void
Inherited from: IgcInputBaseComponent
Returns the HTMLFormElement associated with this element.
get form(): HTMLFormElement | null Defined in src/internals/mixins/forms/types.ts:46
Returns HTMLFormElement | null
required
Section titled "required"Inherited from: IgcInputBaseComponent
get required(): any Defined in src/internals/mixins/forms/types.ts:207
When set, makes the component a required field for validation.
set required(value: boolean): void Defined in src/internals/mixins/forms/types.ts:207
Parameters
- value:
boolean
Returns void
validationMessage
Section titled "validationMessage"Inherited from: IgcInputBaseComponent
A string containing the validation message of this element.
get validationMessage(): string Defined in src/internals/mixins/forms/types.ts:55
Returns string
validity
Section titled "validity"Inherited from: IgcInputBaseComponent
Returns a ValidityState object which represents the different validity states the element can be in, with respect to constraint validation.
get validity(): ValidityState Defined in src/internals/mixins/forms/types.ts:52
Returns ValidityState
value
Section titled "value"The value of the control.
get value(): string Defined in src/components/input/input.ts:115
Returns string
The value of the control.
set value(value: string): void Defined in src/components/input/input.ts:111
Parameters
- value:
string
Returns void
willValidate
Section titled "willValidate"Inherited from: IgcInputBaseComponent
A boolean value which returns true if the element is a submittable element that is a candidate for constraint validation.
get willValidate(): boolean Defined in src/internals/mixins/forms/types.ts:61
Returns boolean
Methods
Section titled "Methods"Inherited from: IgcInputBaseComponent
Removes focus from the control.
blur(): void Defined in src/components/input/input-base.ts:108
Returns void
checkValidity
Section titled "checkValidity"Inherited from: IgcInputBaseComponent
Checks for validity of the control and emits the invalid event if it's invalid.
checkValidity(): boolean Defined in src/internals/mixins/forms/types.ts:166
Returns boolean
focus
Section titled "focus"Inherited from: IgcInputBaseComponent
Sets focus on the control.
focus(options: FocusOptions): void Defined in src/components/input/input-base.ts:102
Parameters
- options:
FocusOptions
Returns void
reportValidity
Section titled "reportValidity"Inherited from: IgcInputBaseComponent
Checks for validity of the control and shows the browser message if it's invalid.
reportValidity(): boolean Defined in src/internals/mixins/forms/types.ts:169
Returns boolean
select
Section titled "select"Inherited from: IgcInputBaseComponent
Selects all the text inside the input.
select(): void Defined in src/components/input/input-base.ts:96
Returns void
setCustomValidity
Section titled "setCustomValidity"Inherited from: IgcInputBaseComponent
Sets a custom validation message for the control.
As long as message is not empty, the control is considered invalid.
setCustomValidity(message: string): void Defined in src/internals/mixins/forms/types.ts:175
Parameters
- message:
string
Returns void
setRangeText
Section titled "setRangeText"Replaces the selected text in the input.
setRangeText(replacement: string, start: number, end: number, selectMode: RangeTextSelectMode): void Defined in src/components/input/input.ts:218
Parameters
- replacement:
string - start:
number - end:
number - selectMode:
RangeTextSelectMode
Returns void
setSelectionRange
Section titled "setSelectionRange"Sets the text selection range of the control
setSelectionRange(start: number, end: number, direction: SelectionRangeDirection): void Defined in src/components/input/input.ts:230
Parameters
- start:
number - end:
number - direction:
SelectionRangeDirection
Returns void
stepDown
Section titled "stepDown"Decrements the numeric value of the input by one or more steps.
stepDown(n: number): void Defined in src/components/input/input.ts:245
Parameters
- n:
number
Returns void
stepUp
Section titled "stepUp"Increments the numeric value of the input by one or more steps.
stepUp(n: number): void Defined in src/components/input/input.ts:239
Parameters
- n:
number