UNPKG

@ui5/webcomponents-react

Version:

React Wrapper for UI5 Web Components and additional components

35 lines (34 loc) 2.88 kB
'use client'; import { withWebComponent } from '@ui5/webcomponents-react-base'; /** * The `Input` component allows the user to enter and edit text or numeric values in one line. * * Additionally, you can provide `suggestionItems` * that are displayed in a popover right under the input. Keep in mind that `Input` with type `Number` does not support suggestions. * * The text field can be editable or read-only (`readonly` property), * and it can be enabled or disabled (`disabled` property). * To visualize semantic states, such as "Negative" or "Critical", the `valueState` property is provided. * When the user makes changes to the text, the change event is fired, * which enables you to react on any text change. * * ### Keyboard Handling * The `Input` provides the following keyboard shortcuts: * * - [Escape] - Closes the suggestion list, if open. If closed or not enabled, cancels changes and reverts to the value which the Input field had when it got the focus. * - [Enter] or [Return] - If suggestion list is open takes over the current matching item and closes it. If value state or group header is focused, does nothing. * - [Down] - Focuses the next matching item in the suggestion list. Selection-change event is fired. * - [Up] - Focuses the previous matching item in the suggestion list. Selection-change event is fired. * - [Home] - If focus is in the text input, moves caret before the first character. If focus is in the list, highlights the first item and updates the input accordingly. * - [End] - If focus is in the text input, moves caret after the last character. If focus is in the list, highlights the last item and updates the input accordingly. * - [Page Up] - If focus is in the list, moves highlight up by page size (10 items by default). If focus is in the input, does nothing. * - [Page Down] - If focus is in the list, moves highlight down by page size (10 items by default). If focus is in the input, does nothing. * - [Ctrl]+[Alt]+[F8] or [Command]+[Option]+[F8] - Focuses the first link in the value state message, if available. Pressing [Tab] moves the focus to the next link in the value state message, or closes the value state message if there are no more links. * * * * __Note:__ This is a UI5 Web Component! [Input UI5 Web Component Documentation](https://ui5.github.io/webcomponents/components/Input) | [Repository](https://github.com/UI5/webcomponents) */ const Input = withWebComponent('ui5-input', ['accessibleDescription', 'accessibleDescriptionRef', 'accessibleName', 'accessibleNameRef', 'filter', 'maxlength', 'name', 'placeholder', 'type', 'value', 'valueState'], ['disabled', 'noTypeahead', 'open', 'readonly', 'required', 'showClearIcon', 'showSuggestions'], ['icon', 'valueStateMessage'], ['change', 'close', 'input', 'open', 'select', 'selection-change']); Input.displayName = 'Input'; export { Input };