Autocomplete
Autocomplete component for Universal Apps
The autocomplete is a normal text input enhanced by a panel of suggested options.
Static List of Options
Creates a basic autocomplete with a static list of options
New-UDAutocomplete -Options @('Test', 'Test2', 'Test3', 'Test4')Dynamic List of Options
When text is typed, it can be filtered with OnLoadOptions. $Body will contain the current text that is typed.
This example filters the array with Where-Object.
New-UDAutocomplete -OnLoadOptions {
@('Test', 'Test2', 'Test3', 'Test4') | Where-Object { $_ -like "*$Body*" } | ConvertTo-Json
}OnChange
$Body contains the currently selected item. The OnChange event will fire when the user selects one or more items.
New-UDAutocomplete -OnLoadOptions {
@('Test', 'Test2', 'Test3', 'Test4') | Where-Object { $_ -like "*$Body*" } | ConvertTo-Json
} -OnChange {
Show-UDToast $Body
}Icon

You can place an icon before an autocomplete by using the -Icon parameter.
OnEnter
OnEnter is triggered when the user presses the enter key within the autocomplete.
Options
You can use New-UDAutoCompleteOption to specify name and values.
API
Last updated
Was this helpful?