-
Notifications
You must be signed in to change notification settings - Fork 459
[dev-v5] Add a generic FluentOption<TOption> #4456
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
base: dev-v5
Are you sure you want to change the base?
Conversation
|
✅ All tests passed successfully Details on your Workflow / Core Tests page. |
Summary - Unit Tests Code CoverageSummary
CoverageMicrosoft.FluentUI.AspNetCore.Components - 98.7%
|
|
@dvoituron the current code works with non nullable properties. However selection via code does not work properly yet. Add <FluentButton OnClick="() => SelectedLanguageId = 1">Select C#</FluentButton>to the sample and then hit it. The value changes but not the displayed one on the dropdown. Using null as option breaks the component. See this code for reference: <FluentSelect Label="Language" @bind-Value="@SelectedLanguageId">
<FluentOption TOption="int?" Value="null"></FluentOption>
@foreach (var language in Languages)
{
<FluentOption Value="@language.Id">
@language.Name
</FluentOption>
}
</FluentSelect>
<div>
Selected: @(SelectedLanguageId?.ToString() ?? "<NULL>")
</div>
@code {
int? SelectedLanguageId;
static Language[] Languages = new Language[]
{
new(1, "C#"),
new(2, "Java"),
new(3, "Python"),
new(4, "JavaScript"),
new(5, "Go")
};
record Language(int Id, string Name);
} |
The |
When I want to provide a manual item then I have to. <FluentOption TOption="int?" Value="null"></FluentOption>This item should mimic the default state and allows the user to unselect a previous selected option. |
[dev-v5] Add a generic FluentOption
This pull request introduces a generic
FluentOption<TOption>component, enabling type-safe options for FluentSelect, FluentCombobox, and related components, and updates supporting infrastructure and samples accordingly.Example:
Unit Tests
Updated