forked from CodeBeamOrg/CodeBeam.MudBlazor.Extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComboBoxExample7.razor
More file actions
78 lines (72 loc) · 4.12 KB
/
ComboBoxExample7.razor
File metadata and controls
78 lines (72 loc) · 4.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
@namespace MudExtensions.Docs.Examples
<MudGrid>
<MudItem xs="12" sm="8" Class="d-flex gap-4 align-center justify-center">
<MudComboBox @bind-Value="@_value" @bind-Text="@_text" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" Label="Highlighted" Editable="true" MultiSelection="@_multiselection" Modal="@_modal"
autocomplete="new-password" Color="_color" Clearable="_clearable" Strict="_strict" Highlight="true" HighlightClass="@(_customHighlightClass ? "mud-theme-primary" : null)" EnableFilter="_enableFilter">
<MudComboBoxItem Value="@("Foo")">Foo</MudComboBoxItem>
<MudComboBoxItem Value="@("Bar")">Bar</MudComboBoxItem>
<MudComboBoxItem Value="@("Fizz")">Fizz</MudComboBoxItem>
<MudComboBoxItem Value="@("Buzz")">Buzz</MudComboBoxItem>
@foreach (var state in states)
{
<MudComboBoxItem Value="@state" Text="@state">@state</MudComboBoxItem>
}
</MudComboBox>
<MudComboBox @bind-Value="@_value" @bind-Text="@_text" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" Label="With NoItemsContent" Editable="true" MultiSelection="@_multiselection" Modal="@_modal"
autocomplete="new-password" Color="_color" Clearable="_clearable" Strict="_strict" EnableFilter="_enableFilter">
<ChildContent>
<MudComboBoxItem Value="@("Foo")">Foo</MudComboBoxItem>
<MudComboBoxItem Value="@("Bar")">Bar</MudComboBoxItem>
<MudComboBoxItem Value="@("Fizz")">Fizz</MudComboBoxItem>
<MudComboBoxItem Value="@("Buzz")">Buzz</MudComboBoxItem>
@foreach (var state in states)
{
<MudComboBoxItem Value="@state" Text="@state">@state</MudComboBoxItem>
}
</ChildContent>
<NoItemsContent>
No Items Found
</NoItemsContent>
</MudComboBox>
</MudItem>
<MudItem xs="12" sm="4">
<MudStack Spacing="4">
<MudSelectExtended @bind-Value="_color" ItemCollection="@(Enum.GetValues<Color>())" Variant="Variant.Outlined" Label="Color" Margin="Margin.Dense" Dense="true" />
<MudSwitchM3 @bind-Value="@_multiselection" Label="Multiselection" Color="Color.Secondary" />
<MudSwitchM3 @bind-Value="@_strict" Label="Strict" Color="Color.Secondary" />
<MudSwitchM3 @bind-Value="@_clearable" Label="Clearable" Color="Color.Secondary" />
<MudSwitchM3 @bind-Value="@_customHighlightClass" Label="Custom Highlight" Color="Color.Secondary" />
<MudSwitchM3 @bind-Value="@_enableFilter" Label="Enable Filter" Color="Color.Secondary" />
<MudSwitchM3 @bind-Value="@_modal" Label="Modal" Color="Color.Secondary" />
</MudStack>
</MudItem>
</MudGrid>
@code {
private string? _value;
private string? _text;
private IEnumerable<string>? _selectedValues;
private Color _color = Color.Primary;
private bool _multiselection;
private bool _clearable;
private bool _strict;
private bool _customHighlightClass;
private bool _enableFilter = true;
private bool _modal = true;
private string[] states =
{
"Alabama", "Alaska", "American Samoa", "Arizona",
"Arkansas", "California", "Colorado", "Connecticut",
"Delaware", "District of Columbia", "Federated States of Micronesia",
"Florida", "Georgia", "Guam", "Hawaii", "Idaho",
"Illinois", "Indiana", "Iowa", "Kansas", "Kentucky",
"Louisiana", "Maine", "Marshall Islands", "Maryland",
"Massachusetts", "Michigan", "Minnesota", "Mississippi",
"Missouri", "Montana", "Nebraska", "Nevada",
"New Hampshire", "New Jersey", "New Mexico", "New York",
"North Carolina", "North Dakota", "Northern Mariana Islands", "Ohio",
"Oklahoma", "Oregon", "Palau", "Pennsylvania", "Puerto Rico",
"Rhode Island", "South Carolina", "South Dakota", "Tennessee",
"Texas", "Utah", "Vermont", "Virgin Island", "Virginia",
"Washington", "West Virginia", "Wisconsin", "Wyoming",
};
}