Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FluentAutocomplete] Add IconDismiss adn IconSearch #1573

Merged
merged 2 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4238,6 +4238,16 @@
Gets or sets the title and Aria-Label for the Scroll to next button.
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentAutocomplete`1.IconDismiss">
<summary>
Gets or sets the icon used for the Clear button. By default: Dismiss icon.
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentAutocomplete`1.IconSearch">
<summary>
Gets or sets the icon used for the Search button. By default: Search icon.
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentAutocomplete`1.ListStyleValue">
<summary />
</member>
Expand Down
30 changes: 18 additions & 12 deletions src/Core/Components/List/FluentAutocomplete.razor
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,27 @@
{
if (this.SelectedOptions?.Any() == true || !string.IsNullOrEmpty(_valueText))
{
<FluentIcon Value="@(new CoreIcons.Regular.Size16.Dismiss())"
Width="12px"
Style="cursor: pointer;"
Slot="end"
Title="Clear"
OnClick="@OnClearAsync" />
if (IconDismiss != null)
{
<FluentIcon Value="@IconDismiss"
Width="12px"
Style="cursor: pointer;"
Slot="end"
Title="Clear"
OnClick="@OnClearAsync" />
}
}
else
{
<FluentIcon Value="@(new CoreIcons.Regular.Size16.Search())"
Width="16px"
Style="cursor: pointer;"
Slot="end"
Title="Search"
OnClick="@OnDropDownExpandedAsync" />
if (IconSearch != null)
{
<FluentIcon Value="@IconSearch"
Width="16px"
Style="cursor: pointer;"
Slot="end"
Title="Search"
OnClick="@OnDropDownExpandedAsync" />
}
}
}
</FluentTextField>
Expand Down
12 changes: 12 additions & 0 deletions src/Core/Components/List/FluentAutocomplete.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,18 @@ public override bool Multiple
[Parameter]
public string TitleScrollToNext { get; set; } = "Next";

/// <summary>
/// Gets or sets the icon used for the Clear button. By default: Dismiss icon.
/// </summary>
[Parameter]
public Icon? IconDismiss { get; set; } = new CoreIcons.Regular.Size16.Dismiss();

/// <summary>
/// Gets or sets the icon used for the Search button. By default: Search icon.
/// </summary>
[Parameter]
public Icon? IconSearch { get; set; } = new CoreIcons.Regular.Size16.Search();

/// <summary />
private string? ListStyleValue => new StyleBuilder()
.AddStyle("width", Width, when: !string.IsNullOrEmpty(Width))
Expand Down
Loading