A search box (SearchBox
) provides an input field for searching content within a site or app to find specific items.
A search box (SearchBox
) provides an input field for searching content within a site or app to find specific items.
<SearchBox ProvideSuggestions="@((filter) => { return ProvideSuggestions(filter); })" @bind-SelectedItem="SelectedItem" /> @if (SelectedItem != null) { <h4>Selected item</h4> @SelectedItem }
<SearchBox ProvideSuggestions="@((filter) => { return ProvideSuggestions(filter); })" IsMultiSelect="true" @bind-SelectedItems="SelectedItems" /> @if (SelectedItems != null) { <h4>Selected items</h4> <ul> @foreach (var item in SelectedItems) { <li>@item</li> } </ul> }
<SearchBox ProvideSuggestions="@((filter) => { return ProvideSearchItemSuggestions(filter); })" ProvideString="@((element) => { return ((SearchItem)element).Name; })"> <SearchItemTemplate> <Persona Text=@(((SearchItem)context).Name) SecondaryText=@(((SearchItem)context).JobDescription) ImageUrl="personFace.jpg" Presence=@PersonaPresenceStatus.Online Size=@PersonaSize.Size48 ShowInitialsUntilImageLoads="true" /> </SearchItemTemplate> </SearchBox>
<SearchBox ProvideSuggestions="@((filter) => { return ProvideSearchItemSuggestions(filter); })" ProvideString="@((element) => { return ((SearchItem)element).Name; })" IsMultiSelect="true" @bind-SelectedItems="SelectedPersons"> <SearchItemTemplate> <Persona Text=@(((SearchItem)context).Name) SecondaryText=@(((SearchItem)context).JobDescription) ImageUrl="personFace.jpg" Presence=@PersonaPresenceStatus.Online Size=@PersonaSize.Size48 ShowInitialsUntilImageLoads="true" /> </SearchItemTemplate> </SearchBox> @if (SelectedPersons != null) { <h4>Selected persons</h4> <ul> @foreach (var item in SelectedPersons) { <li>@(item.Name)</li> } </ul> }
<SearchBox ProvideSuggestions="@((filter) => { return ProvideSearchItemSuggestions(filter); })" ProvideString="@((element) => { return ((SearchItem)element).Name; })" IsMultiSelect="true"> <SearchItemTemplate> <Persona Text=@(((SearchItem)context).Name) SecondaryText=@(((SearchItem)context).JobDescription) ImageUrl="personFace.jpg" Presence=@PersonaPresenceStatus.Online Size=@PersonaSize.Size48 ShowInitialsUntilImageLoads="true" /> </SearchItemTemplate> <SelectedItemTemplate> <div style="display:inline;color:red;font-style:italic">@context.Name</div> </SelectedItemTemplate> </SearchBox>
<div>Start with entering 'a' in order to find suggestions</div> <SearchBox Placeholder="Tell me what you want to do" IconName="Lightbulb" ProvideSuggestions="@((filter) => { return ProvideWhatYouWantToDoSuggestions(filter); })" InputWidth="300"> </SearchBox>