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.

A hint for the browser on how to autofill the control.

autocomplete: string

Defined in src/components/input/input.ts:204

Whether the control should receive focus automatically.

autofocus: boolean

Defined in src/components/input/input.ts:197

Inherited from: IgcInputBaseComponent

The disabled state of the component.

disabled: boolean

Defined in src/internals/mixins/forms/types.ts:30

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

Inherited from: IgcInputBaseComponent

Sets the control into invalid state (visual state only).

invalid: boolean

Defined in src/internals/mixins/forms/types.ts:37

Inherited from: IgcInputBaseComponent

The label for the control.

label: string

Defined in src/components/input/input-base.ts:85

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

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

Inherited from: IgcInputBaseComponent

Whether the control will have outlined appearance.

outlined: boolean = false

Defined in src/components/input/input-base.ts:71

The regular expression the value is validated against.

pattern: string = undefined

Defined in src/components/input/input.ts:150

Inherited from: IgcInputBaseComponent

The placeholder text of the control.

placeholder: string

Defined in src/components/input/input-base.ts:78

Makes the control a readonly field.

readOnly: boolean = false

Defined in src/components/input/input.ts:134

The granularity the value must adhere to.

step: number = undefined

Defined in src/components/input/input.ts:190

The type of the control.

type: InputType = 'text'

Defined in src/components/input/input.ts:125

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

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

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

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

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

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

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

Inherited from: IgcInputBaseComponent

Removes focus from the control.

blur(): void

Defined in src/components/input/input-base.ts:108

Returns void

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

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

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

Inherited from: IgcInputBaseComponent

Selects all the text inside the input.

select(): void

Defined in src/components/input/input-base.ts:96

Returns void

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

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

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

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

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

Returns void