TextBoxModel

23 Sep 20252 minutes to read

Interface for a class TextBox

Properties

blur EmitType<FocusOutEventArgs>

Triggers when the TextBox has focus-out.

change EmitType<ChangedEventArgs>

Triggers when the content of TextBox has changed and gets focus-out.

created EmitType<Object>

Triggers when the TextBox component is created.

destroyed EmitType<Object>

Triggers when the TextBox component is destroyed.

focus EmitType<FocusInEventArgs>

Triggers when the TextBox gets focus.

input EmitType<InputEventArgs>

Triggers each time when the value of TextBox has changed.

autocomplete string

Specifies whether the browser is allow to automatically enter or select a value for the textbox.
By default, autocomplete is enabled for textbox.
Possible values are:
on - Specifies that autocomplete is enabled.
off - Specifies that autocomplete is disabled.

cssClass string

Specifies the CSS class value that is appended to wrapper of Textbox.

enablePersistence boolean

Enable or disable persisting TextBox state between page reloads. If enabled, the value state will be persisted.

enableRtl boolean

Enable or disable rendering component in right to left direction.

enabled boolean

Specifies a Boolean value that indicates whether the TextBox allow user to interact with it.

floatLabelType FloatLabelType

Specifies the floating label behavior of the TextBox that the placeholder text floats above the TextBox based on the below values.
Possible values are:

  • Never - The placeholder text should not be float ever.
  • Always - The placeholder text floats above the TextBox always.
  • Auto - The placeholder text floats above the TextBox while focusing or enter a value in Textbox.

htmlAttributes { : }

You can add the additional html attributes such as disabled, value etc., to the element.
If you configured both property and equivalent html attribute then the component considers the property value.

<input id="textbox" type="text" />
import { TextBox } from '@syncfusion/ej2-inputs';

let textbox: TextBox = new TextBox({
  htmlAttributes: { name: "username", type: "password", maxlength:"8" }
});
textbox.appendTo('#textbox');

locale string

Overrides the global culture and localization value for this component. Default global culture is ‘en-US’.

multiline boolean

Specifies a boolean value that enable or disable the multiline on the TextBox.
The TextBox changes from single line to multiline when enable this multiline mode.

placeholder string

Specifies the text that is shown as a hint/placeholder until the user focus or enter a value in Textbox.
The property is depending on the floatLabelType property.

readonly boolean

Specifies the boolean value whether the TextBox allows user to change the text.

showClearButton boolean

Specifies a Boolean value that indicates whether the clear button is displayed in Textbox.

type string

Specifies the behavior of the TextBox such as text, password, email, etc.

value string

Sets the content of the TextBox.

width number|string

Specifies the width of the Textbox component.