Textfield

<vscode-textfield>

A simple inline textfield

When participating in a form, it supports the :invalid pseudo class. Otherwise the error styles can be applied through the invalid property.

Properties

autocomplete
Attributeautocomplete
Type'on' | 'off' | undefined
Defaultundefined
autofocus reflected
Attributeautofocus
Typeboolean
Defaultfalse
defaultValue
Attributedefault-value
Typestring
Default''
disabled reflected
Attributedisabled
Typeboolean
Defaultfalse
focused reflected
Attributefocused
Typeboolean
Defaultfalse
form readonly
TypeHTMLFormElement | null
invalid reflected

Set error styles on the component. This is only intended to apply styles when custom error validation is implemented. To check whether the component is valid, use the checkValidity method.

Attributeinvalid
Typeboolean
Defaultfalse
max
Attributemax
Typenumber | undefined
Defaultundefined
maxLength
AttributemaxLength
Typenumber | undefined
Defaultundefined
maxlength

Lowercase alias to maxLength

Typenumber | undefined
min
Attributemin
Typenumber | undefined
Defaultundefined
minLength
AttributeminLength
Typenumber | undefined
Defaultundefined
minlength

Lowercase alias to minLength

Typenumber | undefined
multiple reflected
Attributemultiple
Typeboolean
Defaultfalse
name reflected
Attributename
Typestring | undefined
Defaultundefined
pattern

Specifies a regular expression the form control's value should match. MDN Reference

Attributepattern
Typestring | undefined
Defaultundefined
placeholder
Attributeplaceholder
Typestring | undefined
Defaultundefined
readonly reflected
Attributereadonly
Typeboolean
Defaultfalse
required reflected
Attributerequired
Typeboolean
Defaultfalse
step
Attributestep
Typenumber | undefined
Defaultundefined
type reflected

Same as the type of the native <input> element but only a subset of types are supported. The supported ones are: color,date,datetime-local,email,file,month,number,password,search,tel,text,time,url,week

Attributetype
TypeInputType

validationMessage readonly

validity readonly
TypeValidityState
value
Attributevalue
Typestring
version readonly

VSC Element version

willValidate readonly

wrappedElement readonly
TypeHTMLInputElement

Methods

checkValidity

Check the component's validity state when built-in validation is used. Built-in validation is triggered when any validation-related attribute is set. Validation-related attributes are: max, maxlength, min, minlength, pattern, required, step. See this the MDN reference for more details.

Returnboolean

reportValidity

Events

change
TypeEvent
input
TypeInputEvent
vsc-change deprecated
TypeCustomEvent
vsc-input deprecated
TypeCustomEvent

Slots

content-after

A slot after the editable area but inside of the component. It is used to place icons.

content-before

A slot before the editable area but inside of the component. It is used to place icons.

Custom CSS Properties

--vscode-button-background

--vscode-button-foreground

--vscode-button-hoverBackground

--vscode-focusBorder

--vscode-font-family

--vscode-font-size

--vscode-font-weight

--vscode-input-placeholderForeground

--vscode-settings-textInputBackground

--vscode-settings-textInputBorder

--vscode-settings-textInputForeground