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.

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 url/email type 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

Whether the control should receive focus automatically.

autofocus: boolean

A hint to the browser for which virtual keyboard layout to display. See relevant MDN article

inputMode: string

The label for the control.

label: string

The maximum value the control accepts.

max: number | undefined

The maximum string length of the control.

maxLength: number | undefined

The minimum value the control accepts.

min: number | undefined

The minimum string length required by the control.

minLength: number | undefined

Whether the control will have outlined appearance.

outlined: boolean

The regular expression the value is validated against.

pattern: string | undefined

The placeholder text of the control.

placeholder: string

Makes the control a readonly field.

readOnly: boolean

The granularity the value must adhere to.

step: number | undefined

The type of the control.

type: InputType

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

The value of the control.

value: string

Removes focus from the control.

blur(): void

Returns void

Sets focus on the control.

focus(options: FocusOptions): void

Parameters

  • options: FocusOptions

Returns void

Selects all the text inside the input.

select(): void

Returns void

Replaces the selected text in the input.

setRangeText(replacement: string, start: number, end: number, selectMode: RangeTextSelectMode): void

Parameters

Returns void

Sets the text selection range of the control

setSelectionRange(start: number, end: number, direction: SelectionRangeDirection): void

Parameters

Returns void

Decrements the numeric value of the input by one or more steps.

stepDown(n: number): void

Parameters

  • n: number

Returns void

Increments the numeric value of the input by one or more steps.

stepUp(n: number): void

Parameters

  • n: number

Returns void

Emitted when the value of the control is committed.

onChange(args: CustomEvent<string>): void

Parameters

Returns void

Emitted when the control input receives user input.

onInput(args: CustomEvent<string>): void

Parameters

Returns void