Overview
Input Text is a form entry component, where users can enter a customized text or string.
Input Text can limit the number of characters with its max and min properties.
Sample
Usage
- Text or string submissions in forms
Accessibility
Keyboard navigation
| Key | Function |
|---|---|
Tab | Moves focus in and out of the component. |
Tab and Shift | Moves focus in and out of the component. |
Esc | When clearable is true, clears the component's value. |
API reference
Properties
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
| alignment | alignment | Specifies the text alignment of the component's | Alignment | "start" |
| autocomplete | autocomplete | Specifies the type of content to autocomplete, for use in forms. Read the native attribute's documentation on MDN for more info. | AutoFill | |
| clearable | clearable | When | boolean | false |
| disabled | disabled | When | boolean | false |
| form | form | Specifies the When not set, the component is associated with its ancestor form element, if one exists. | string | |
| icon | icon | Specifies an icon to display. | IconName | boolean | |
| iconFlipRtl | icon-flip-rtl | When | boolean | false |
| label | label | Specifies an accessible label for the component's button or hyperlink. | string | |
| labelText | label-text | Specifies the component's label text. | string | |
| loading | loading | When | boolean | false |
| maxLength | max-length | When the component resides in a form, specifies the maximum length of text for the component's value. | number | |
| messageOverrides | Overrides individual strings used by the component. | Record<string, unknown> | undefined | ||
| minLength | min-length | When the component resides in a form, specifies the minimum length of text for the component's value. | number | |
| name | name | Specifies the name of the component. Required to pass the component's | string | |
| pattern | pattern | When the component resides in a form,
specifies a regular expression (regex) pattern the component's | string | |
| placeholder | placeholder | Specifies the component's placeholder text. | string | |
| prefixText | prefix-text | Specifies text to display at the start of the component. | string | |
| readOnly | read-only | When | boolean | false |
| required | required | When | boolean | false |
| scale | scale | Specifies the size of the component. | Scale | "m" |
| status | status | Specifies the input field's status, which determines message and icons. | Status | "idle" |
| suffixText | suffix-text | Specifies text to display at the end of the component. | string | |
| validationIcon | validation-icon | Specifies the validation icon to display under the component. | IconName | boolean | |
| validationMessage | validation-message | Specifies the validation message to display under the component. | string | |
| validity | The component's current validation state. | ValidityState | ||
| value | value | The component's value. | string |
Slots
| Name | Description |
|---|---|
| action | A slot for positioning a |
| label-content | A slot for rendering content next to the component's |
Styles
| Name | Description |
|---|---|
| --calcite-input-action-background-color | Specifies the background color of the component's |
| --calcite-input-action-background-color-hover | Specifies the background color of the component's |
| --calcite-input-action-background-color-press | Specifies the background color of the component's |
| --calcite-input-action-icon-color | Specifies the icon color of the component's |
| --calcite-input-action-icon-color-hover | Specifies the icon color of the component's |
| --calcite-input-action-icon-color-press | Specifies the icon color of the component's |
| --calcite-input-loading-background-color | When |
| --calcite-input-loading-fill-color | When |
| --calcite-input-prefix-size-x | When |
| --calcite-input-prefix-text-color | When |
| --calcite-input-suffix-size-x | When |
| --calcite-input-suffix-text-color | When |
| --calcite-input-text-background-color | Specifies the component's background color. |
| --calcite-input-text-border-color | Specifies the component's border color. |
| --calcite-input-text-corner-radius | Specifies the component's border radius. |
| --calcite-input-text-icon-color | Specifies the component's |
| --calcite-input-text-placeholder-text-color | Specifies the component's |
| --calcite-input-text-text-color | Specifies the component's text color. |
| --calcite-input-text-text-color-focus | Specifies the component's text color when focused. |
Events
| Name | Description | Behavior |
|---|---|---|
| calciteInputTextChange | Fires each time a new | |
| calciteInputTextInput | Fires each time a new |
Methods
| Name | Description | Signature |
|---|---|---|
| componentOnReady | Creates a promise that resolves once the component is fully loaded. | componentOnReady(): Promise<this> |
| selectText | Selects the text of the component's | selectText(): Promise<void> |
| setFocus | Sets focus on the component. | setFocus(options?: FocusOptions): Promise<void> |