Skip to main content

Input

<ui5-ai-input> | Since 2.16.0
info

The @ui5/webcomponents-ai package is under active development and considered experimental. Component APIs are subject to change. Furthermore, the package supports Horizon themes only.

The ui5-ai-input component extends the standard ui5-input with AI Writing Assistant capabilities.

Structure​

The ui5-ai-input consists of the following main parts:

  • Input Field – Inherits all standard Input behaviors.
  • AI Action Button – Appears when focused or loading, providing access to AI-related actions or stopping generation.

The component automatically determines which elements to render based on its internal state:

  • The AI Button is only shown when there are available actions.
  • The version navigation appears only when totalVersions > 1.

Keyboard Support​

  • Shift + F4 — Opens the AI menu.
  • Ctrl + Shift + Z / Y — Navigates backward/forward between AI-generated versions.

ES6 Module Import​

import "@ui5/webcomponents-ai/dist/Input.js";

Basic Sample​

Properties​

currentVersion​

DescriptionIndicates the index of the currently displayed version.
Typenumber
Default0

loading​

DescriptionDefines whether the AI Writing Assistant is currently loading.
When true, indicates that an AI action is in progress.
Typeboolean
Defaultfalse

totalVersions​

DescriptionIndicates the total number of result versions available.
When not set or set to 0, the versioning will be hidden.
Typenumber
Default0

accessibleDescription​

DescriptionDefines the accessible description of the component.
Typestring | undefined
Defaultundefined
Since2.9.0

accessibleDescriptionRef​

DescriptionReceives id(or many ids) of the elements that describe the input.
Typestring | undefined
Defaultundefined
Since2.9.0

accessibleName​

DescriptionDefines the accessible ARIA name of the component.
Typestring | undefined
Defaultundefined
Since1.0.0-rc.15

accessibleNameRef​

DescriptionReceives id(or many ids) of the elements that label the input.
Typestring | undefined
Defaultundefined
Since1.0.0-rc.15

disabled​

DescriptionDefines whether the component is in disabled state.
Note: A disabled component is completely noninteractive.
Typeboolean
Defaultfalse

filter​

DescriptionDefines the filter type of the component.
Type"Contains" | "None" | "StartsWith" | "StartsWithPerTerm" (value descriptions in: InputSuggestionsFilter)
Default"None"
Since2.19.0

maxlength​

DescriptionSets the maximum number of characters available in the input field.
Note: This property is not compatible with the ui5-input type InputType.Number. If the ui5-input type is set to Number, the maxlength value is ignored.
Typenumber | undefined
Defaultundefined
Since1.0.0-rc.5

name​

DescriptionDetermines the name by which the component will be identified upon submission in an HTML form.
Note: This property is only applicable within the context of an HTML Form element.
Typestring | undefined
Defaultundefined

noTypeahead​

DescriptionDefines whether the value will be autcompleted to match an item
Typeboolean
Defaultfalse
Since1.4.0

open​

DescriptionDefines whether the suggestions picker is open. The picker will not open if the showSuggestions property is set to false, the input is disabled or the input is readonly. The picker will close automatically and close event will be fired if the input is not in the viewport.
Typeboolean
Defaultfalse
Since2.0.0

placeholder​

DescriptionDefines a short hint intended to aid the user with data entry when the component has no value.
Typestring | undefined
Defaultundefined

readonly​

DescriptionDefines whether the component is read-only.
Note: A read-only component is not editable, but still provides visual feedback upon user interaction.
Typeboolean
Defaultfalse

required​

DescriptionDefines whether the component is required.
Typeboolean
Defaultfalse
Since1.0.0-rc.3

showClearIcon​

DescriptionDefines whether the clear icon of the input will be shown.
Typeboolean
Defaultfalse
Since1.2.0

showSuggestions​

DescriptionDefines whether the component should show suggestions, if such are present.
Typeboolean
Defaultfalse

type​

DescriptionDefines the HTML type of the component.
Notes:
- The particular effect of this property differs depending on the browser and the current language settings, especially for type Number.
- The property is mostly intended to be used with touch devices that use different soft keyboard layouts depending on the given input type.
- Type Number does not support suggestions.
Type"Email" | "Number" | "Password" | "Search" | "Tel" | "Text" | "URL" (value descriptions in: InputType)
Default"Text"

value​

DescriptionDefines the value of the component.
Note: The property is updated upon typing.
Typestring
Default""

valueState​

DescriptionDefines the value state of the component.
Type"Critical" | "Information" | "Negative" | "None" | "Positive"
Default"None"

Slots​

actions​

DescriptionDefines the items of the menu for the component.
TypeArray<HTMLElement>

default​

DescriptionDefines the suggestion items.
Note: The suggestions would be displayed only if the showSuggestions property is set to true.
Note: The <ui5-suggestion-item>, <ui5-suggestion-item-group> and ui5-suggestion-item-custom are recommended to be used as suggestion items.
Note: Input with type Number does not support suggestions.
TypeArray<IInputSuggestionItem>

icon​

DescriptionDefines the icon to be displayed in the component.
TypeArray<IIcon>

valueStateMessage​

DescriptionDefines the value state message that will be displayed as pop up under the component. The value state message slot should contain only one root element.
Note: If not specified, a default text (in the respective language) will be displayed.
Note: The valueStateMessage would be displayed, when the component is in Information, Critical or Negative value state.
Note: If the component has suggestionItems, the valueStateMessage would be displayed as part of the same popover, if used on desktop, or dialog - on phone.
TypeArray<HTMLElement>
Since1.0.0-rc.6

Events​

button-click​

DescriptionFired when the user selects the AI button.
TypeCustomEvent
BubblesNo
CancelableYes - via preventDefault()

item-click​

DescriptionFired when an item from the AI actions menu is clicked.
TypeCustomEvent<InputItemClickEventDetail>
Parametersitem: HTMLElement
The currently clicked menu item.
text: string
The text of the currently clicked menu item.
BubblesNo
CancelableNo

stop-generation​

DescriptionFired when the user selects the "Stop" button to stop ongoing AI text generation.
TypeCustomEvent
BubblesNo
CancelableNo

version-change​

DescriptionFired when the user selects the version navigation buttons.
TypeCustomEvent<InputVersionChangeEventDetail>
Parametersbackwards: boolean
The text of the currently clicked menu item.
BubblesNo
CancelableNo

change​

DescriptionFired when the input operation has finished by pressing Enter or on focusout.
TypeCustomEvent
BubblesYes
CancelableNo

close​

DescriptionFired when the suggestions picker is closed.
TypeCustomEvent
Since2.0.0
BubblesNo
CancelableNo

input​

DescriptionFired when the value of the component changes at each keystroke, and when a suggestion item has been selected.
TypeCustomEvent
BubblesYes
CancelableYes - via preventDefault()

open​

DescriptionFired when the suggestions picker is open.
TypeCustomEvent
Since2.0.0
BubblesYes
CancelableNo

select​

DescriptionFired when some text has been selected.
TypeCustomEvent
Since2.0.0
BubblesYes
CancelableNo

selection-change​

DescriptionFired when the user navigates to a suggestion item via the ARROW keys, as a preview, before the final selection.
TypeCustomEvent<InputSelectionChangeEventDetail>
Parametersitem: HTMLElement
The previewed suggestion item.
Since2.0.0
BubblesYes
CancelableNo

Methods​

No methods available for this component.

CSS Parts​

For more information on how to use CSS shadow parts, see Usage of CSS Shadow Parts.

NameDescription
clear-iconUsed to style the clear icon, which can be pressed to clear user input text
inputUsed to style the native input element
rootUsed to style the root DOM element of the Input component

CSS Custom States​

No CSS custom states available for this component.