@microsoft/fast-foundation > TextField

TextField class

A Text Field Custom HTML Element. Based largely on the <input type="text" /> element.

start - Content which can be provided before the number field input

end - Content which can be provided after the number field input

  • The default slot for the label

label - The label

root - The element wrapping the control, including start and end slots

control - The text field element

change - Fires a custom 'change' event when the value has changed

Signature:

export declare class TextField extends FormAssociatedTextField 

Properties

Property Modifiers Type Description
autofocus boolean Indicates that this element should get focus after the page finishes loading. See autofocus HTML attribute for more information.
list string Allows associating a datalist to the element by https://developer.mozilla.org/en-US/docs/Web/API/Element/id.
maxlength number The maximum number of characters a user can enter.
minlength number The minimum number of characters a user can enter.
pattern string A regular expression that the value must match to pass validation.
placeholder string Sets the placeholder value of the element, generally used to provide a hint to the user.
readOnly boolean When true, the control will be immutable by user interaction. See readonly HTML attribute for more information.
size number Sets the width of the element to a specified number of characters.
spellcheck boolean Controls whether or not to enable spell checking for the input field, or if the default spell checking configuration should be used.
type TextFieldType Allows setting a type or mode of text.

Methods

Method Modifiers Description
select() Selects all the text in the text field