An input that provides a list of suggestions that the user can choose from.
Adds
aria-describedby
to the component. If you're using this component within a form field, don't set this property because the form field component automatically sets it. Use this property if the component isn't surrounded by a form field, or you want to override the value automatically set by the form field (for example, if you have two components within a single form field).To use it correctly, define an ID for each element that you want to use as a description and set the property to a string of each ID separated by spaces (for example,
"id1 id2 id3"
).
Type: String
Required: No
Adds an
aria-label
to the native control. Use this if you don't have a visible label for this control.
Type: String
Required: No
Adds
aria-labelledby
to the component. If you're using this component within a form field, don't set this property because the form field component automatically sets it. Use this property if the component isn't surrounded by a form field, or you want to override the value automatically set by the form field (for example, if you have two components within a single form field).To use it correctly, define an ID for the element you want to use as label and set the property to that ID.
Type: String
Required: No
Specifies whether to add
aria-required
to the native control.
Type: Boolean
Default: false
Valid values: true | false
Required: No
Indicates whether the control should be focused as soon as the page loads, which enables the user to start typing without having to manually focus the control. Don't use this option on pages where the control may be scrolled out of the viewport.
Type: Boolean
Default: false
Valid values: true | false
Required: No
Adds the specified classes to the root element of the component.
Type: String
Required: No
Specifies the ID of the native form element. You can use it to relate a label element's
for
attribute to this control. It defaults to an automatically generated ID that is provided by its parent form field component.
Type: String
Required: No
Specifies whether to disable browser autocorrect and related features. If you set this to
true
, it disables any native browser capabilities that automatically correct user input, such asautocorrect
andautocapitalize
. If you don't set it, the behavior follows the default behavior of the user's browser.
Type: Boolean
Default: false
Valid values: true | false
Required: No
Specifies if the control is disabled, which prevents the user from modifying the value and prevents the value from being included in a form submission. A disabled control can't receive focus.
Type: Boolean
Default: false
Valid values: true | false
Required: No
Specifies a function that generates the custom value indicator (for example,
\
Use "${value}"``).
Type: (value: string) => string
Required: Yes
Specifies the text to display when a data fetching error occurs. Make sure that you provide
recoveryText
.
Type: String
Required: No
Enabling this property will allow the dropdown to extend beyond its parent by using fixed positioning and React Portals. If you want the dropdown to ignore the
overflow
CSS property of its parents, such as in a split view layout, enable this property. However, use discretion. If you don't need to, we recommend you don't enable this property because fixed positioning results in a slight, visible lag when scrolling complex pages.
Type: Boolean
Default: false
Valid values: true | false
Required: No
Determines how filtering is applied to the list of
options
:
auto
- The component will automatically filter options based on user input.manual
- You will set uponChange
oronLoadItems
event listeners and filter options on your side or request them from server. By default the component will filter the providedoptions
based on the value of the filtering input field. Only options that have avalue
orlabel
that contains the input value as a substring are displayed in the list of options.If you set this property to
manual
, this default filtering mechanism is disabled and all providedoptions
are displayed in the dropdown list. In that case make sure that you use theonChange
oronLoadItems
events in order to set theoptions
property to the options that are relevant for the user, given the filtering input value.Note: Manual filtering doesn't disable match highlighting.
Type: String
Valid values: none | auto | manual
Required: No
Specifies the text to display at the bottom of the dropdown menu after pagination has reached the end.
Type: String
Required: No
Adds the specified ID to the root element of the component.
Type: String
Required: No
Overrides the invalidation state. Usually the invalid state comes from the parent
FormField
/awsui-form-field
component, however sometimes you need to override its state when you have more than one input within a single form field.
Type: Boolean
Default: false
Valid values: true | false
Required: No
Specifies the text to display when in the loading state.
Type: String
Required: No
Specifies the name of the control used in HTML forms.
Type: String
Required: No
Specifies an array of options that are displayed to the user as a dropdown list. The options can be grouped using
OptionGroup
objects. Note: Only one level of option nesting is supported.If you want to use the built-in filtering capabilities of this component, provide a list of all valid options here and they will be automatically filtered based on the user's filtering input.
Alternatively, you can listen to the
onChange
oronLoadItems
event and set new options on your own.
Type: AutosuggestProps.Options
Required: No
Specifies the placeholder text rendered when the value is an empty string.
Type: String
Required: No
Specifies if the control is read only, which prevents the user from modifying the value but includes it in a form submission. A read-only control can receive focus. Don't use read-only inputs outside a form.
Type: Boolean
Default: false
Valid values: true | false
Required: No
Specifies the text for the recovery button. The text is displayed next to the error text. Use the
onLoadItems
event to perform a recovery action (for example, retrying the request).
Type: String
Required: No
Specifies the current status of loading more options.
pending
- Indicates that no request in progress, but more options may be loaded.loading
- Indicates that data fetching is in progress.finished
- Indicates that pagination has finished and no more requests are expected.error
- Indicates that an error occurred during fetch. You should userecoveryText
to enable the user to recover.
Type: String
Valid values: pending | loading | finished | error
Required: No
Specifies the text entered into the form element.
Type: String
Required: Yes
If you have more than 500 options, enable this flag to apply a performance optimization that makes the filtering experience smoother. We don't recommend enabling the feature if you have less than 500 options, because the improvements to performance are offset by a visible scrolling lag. When you set this flag to
true
, it removes options that are not currently in view from the DOM. If your test accesses such options, you need to first scroll the options container to the correct offset, before performing any operations on them. Use the element returned by thefindOptionsContainer
test utility for this.
Type: Boolean
Default: false
Valid values: true | false
Required: No
Specifies the text that's displayed when there aren't any suggestions to display. This is displayed when
statusType
is set tofinished
or it's not set at all.
Called when input focus is removed from the UI control.
Detail type:
Null
Cancelable: No
Called whenever a user changes the input value (by typing or pasting). The event
detail
contains the current value of the field.
Detail type:
InputProps.ChangeDetail {
value: string
}
Cancelable: No
Called when input focus is moved to the UI control.
Detail type:
Null
Cancelable: No
Called when the underlying native textarea emits a
keydown
event. The eventdetail
contains thekeyCode
and information about modifiers (that is, CTRL, ALT, SHIFT, META, etc.).
Detail type:
InputProps.KeyDetail {
altKey: boolean
ctrlKey: boolean
key: string
keyCode: number
metaKey: boolean
shiftKey: boolean
}
Cancelable: Yes
Called when the underlying native textarea emits a
keyup
event. The eventdetail
contains thekeyCode
and information about modifiers (that is, CTRL, ALT, SHIFT, META, etc.).
Detail type:
InputProps.KeyDetail {
altKey: boolean
ctrlKey: boolean
key: string
keyCode: number
metaKey: boolean
shiftKey: boolean
}
Cancelable: Yes
Use this event to implement the asynchronous behavior for the component. The event is called in the following situations:
- The user scrolls to the end of the list of options, if
statusType
is set topending
.- The user clicks on the recovery button in the error state.
- The user types inside the input field.
- The user focuses the input field.
The detail object contains the following properties:
filteringText
- The value that you need to use to fetch options.firstPage
- Indicates that you should fetch the first page of options that match thefilteringText
.samePage
- Indicates that you should fetch the same page that you have previously fetched (for example, when the user clicks on the recovery button).
Detail type:
OptionsLoadItemsDetail {
filteringText: string
firstPage: boolean
samePage: boolean
}
Cancelable: No
Called whenever a user selects an option in the dropdown. Don't use this event as the only way to handle user input. Instead, use
onSelect
in combination with theonChange
handler only as an optional convenience for the user.
Detail type:
AutosuggestProps.SelectDetail {
value: string
}
Cancelable: No
The documentation is made available under the Creative Commons Attribution-ShareAlike 4.0 International License. See the LICENSE file.