microsoft / fluentui-blazor

Microsoft Fluent UI Blazor components library. For use with ASP.NET Core Blazor applications
https://www.fluentui-blazor.net
MIT License
3.87k stars 376 forks source link

docs: dynamic autocomplete with Multiple = false #1867

Closed verdie-g closed 7 months ago

verdie-g commented 7 months ago

🙋 Documentation Request

I'm looking for an AutoComplete with Multiple = false (and a SelectedOption) and an OnOptionsSearch to generate the options.

On AutoComplete.Multiple it mentions

For FluentAutocomplete, this property must be True. Set the FluentAutocomplete.MaximumSelectedOptions property to 1 to select just one item.

So maybe I set MaximumSelectedOptions to 1 and use AutoCompleteSelectedOption

Gets or sets the selected item. ⚠️ Only available when Multiple = false.

I suppose AutoComplete is not the right tool for my use-case but looking at Combobox it seems like I need to generate all options in advance which is not great.

💁 Possible Solution

The documentation for AutoComplete.Multiple could also mention what are the alternatives to have an autocomplete that binds to a single value.

vnbaaij commented 7 months ago

AutoComplete allows you to type and select from a set list. Combobox allows you to select from a list or use a free form text. These commoners share the same base component internally but have a very different UI purpose. Not really sure what you are looking for. In any case, an AutoComplete with just 1 option is not what we consider a very useful use case, so we are not planning on changing anything on the docs regarding that.

verdie-g commented 7 months ago

Basically I would need a Combobox but with the same OnOptionsSearch as Autocomplete to only load options matching the input.

vnbaaij commented 7 months ago

A Combobox, by default, searches through the options in its list if you set the Autocomplete parameter: https://fluentui-blazor.net/Combobox#autocompleteexamples