Skip to content

Commit d41ca2d

Browse files
YomodoJeffrey Jangli
andauthored
ComboBox: Enabled Clearable for doc examples (#318)
* ComboBox: Enabled Clearable for examples * Added parameter defaults as remarks --------- Co-authored-by: Jeffrey Jangli <Jeffrey.Jangli@kpn.com>
1 parent 1dc702c commit d41ca2d

5 files changed

Lines changed: 35 additions & 16 deletions

File tree

CodeBeam.MudBlazor.Extensions/Components/ComboBox/MudComboBox.razor.cs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ protected internal void SetSearchString(T value)
9797
/// If true, all items are eligible regarding what user search in textfield. Default is false.
9898
/// </summary>
9999
[Category(CategoryTypes.FormComponent.Appearance)]
100-
[Parameter] public bool DisableFilter { get; set; } = false;
100+
[Parameter] public bool DisableFilter { get; set; }
101101

102102
/// <summary>
103103
/// If true, searched text has highlight.
@@ -223,48 +223,55 @@ protected internal void SetSearchString(T value)
223223
/// <summary>
224224
/// If true, compact vertical padding will be applied to all Select items.
225225
/// </summary>
226+
/// <remarks>The default is <see cref="Dense.Standard"/></remarks>
226227
[Parameter]
227228
[Category(CategoryTypes.FormComponent.ListAppearance)]
228229
public Dense Dense { get; set; } = Dense.Standard;
229230

230231
/// <summary>
231232
/// The Open Select Icon
232233
/// </summary>
234+
/// <remarks>The default is <see cref="Icons.Material.Filled.ArrowDropDown"/></remarks>
233235
[Parameter]
234236
[Category(CategoryTypes.FormComponent.Appearance)]
235237
public string OpenIcon { get; set; } = Icons.Material.Filled.ArrowDropDown;
236238

237239
/// <summary>
238240
/// The Close Select Icon
239241
/// </summary>
242+
/// <remarks>The default is <see cref="Icons.Material.Filled.ArrowDropUp"/></remarks>
240243
[Parameter]
241244
[Category(CategoryTypes.FormComponent.Appearance)]
242245
public string CloseIcon { get; set; } = Icons.Material.Filled.ArrowDropUp;
243246

244247
/// <summary>
245248
/// Dropdown color of select. Supports theme colors.
246249
/// </summary>
250+
/// <remarks>The default is <see cref="Color.Primary"/></remarks>
247251
[Parameter]
248252
[Category(CategoryTypes.FormComponent.Appearance)]
249253
public Color Color { get; set; } = Color.Primary;
250254

251255
/// <summary>
252256
/// The input's visual.
253257
/// </summary>
258+
/// <remarks>The default is <see cref="ValuePresenter.Text"/></remarks>
254259
[Parameter]
255260
[Category(CategoryTypes.FormComponent.Appearance)]
256261
public ValuePresenter InputPresenter { get; set; } = ValuePresenter.Text;
257262

258263
/// <summary>
259264
/// The items' visual in popover.
260265
/// </summary>
266+
/// <remarks>The default is <see cref="ValuePresenter.Text"/></remarks>
261267
[Parameter]
262268
[Category(CategoryTypes.FormComponent.Appearance)]
263269
public ValuePresenter ItemPresenter { get; set; } = ValuePresenter.Text;
264270

265271
/// <summary>
266-
/// If true, shows checkbox when multiselection is true. Default is true.
272+
/// If true, shows checkbox when multiselection is true.
267273
/// </summary>
274+
/// <remarks>The default is <c>true</c></remarks>
268275
[Parameter]
269276
[Category(CategoryTypes.FormComponent.ListBehavior)]
270277
public bool ShowCheckbox { get; set; } = true;
@@ -279,13 +286,15 @@ protected internal void SetSearchString(T value)
279286
/// <summary>
280287
/// Sets position of the Select All checkbox
281288
/// </summary>
289+
/// <remarks>The default is <see cref="SelectAllPosition.BeforeSearchBox"/></remarks>
282290
[Parameter]
283291
[Category(CategoryTypes.List.Appearance)]
284292
public SelectAllPosition SelectAllPosition { get; set; } = SelectAllPosition.BeforeSearchBox;
285293

286294
/// <summary>
287295
/// Define the text of the Select All option.
288296
/// </summary>
297+
/// <remarks>The default is <c>Select All</c></remarks>
289298
[Parameter]
290299
[Category(CategoryTypes.FormComponent.ListAppearance)]
291300
public string SelectAllText { get; set; } = "Select All";
@@ -329,52 +338,60 @@ protected internal void SetSearchString(T value)
329338
[Category(CategoryTypes.List.Behavior)]
330339
public string ChipClass { get; set; }
331340

341+
/// <remarks>The default is <see cref="Variant.Filled"/></remarks>
332342
[Parameter]
333343
[Category(CategoryTypes.List.Behavior)]
334344
public Variant ChipVariant { get; set; } = Variant.Filled;
335345

346+
/// <remarks>The default is <see cref="Size.Small"/></remarks>
336347
[Parameter]
337348
[Category(CategoryTypes.List.Behavior)]
338349
public Size ChipSize { get; set; } = Size.Small;
339350

340351
/// <summary>
341352
/// Parameter to define the delimited string separator.
342353
/// </summary>
354+
/// <remarks>The default is <c>, </c></remarks>
343355
[Parameter]
344356
[Category(CategoryTypes.FormComponent.Behavior)]
345357
public string Delimiter { get; set; } = ", ";
346358

347359
/// <summary>
348360
/// If true popover width will be the same as the combobox component.
349361
/// </summary>
362+
/// <remarks>The default is <c>true</c></remarks>
350363
[Parameter]
351364
[Category(CategoryTypes.FormComponent.Behavior)]
352365
public bool RelativeWidth { get; set; } = true;
353366

354367
/// <summary>
355368
/// Sets the maxheight of the popover.
356369
/// </summary>
370+
/// <remarks>The default is <c>300</c></remarks>
357371
[Parameter]
358372
[Category(CategoryTypes.FormComponent.ListAppearance)]
359373
public int MaxHeight { get; set; } = 300;
360374

361375
/// <summary>
362376
/// Set the anchor origin point to determine where the popover will open from.
363377
/// </summary>
378+
/// <remarks>The default is <see cref="Origin.BottomCenter"/></remarks>
364379
[Parameter]
365380
[Category(CategoryTypes.FormComponent.ListAppearance)]
366381
public Origin AnchorOrigin { get; set; } = Origin.BottomCenter;
367382

368383
/// <summary>
369384
/// Sets the transform origin point for the popover.
370385
/// </summary>
386+
/// <remarks>The default is <see cref="Origin.TopCenter"/></remarks>
371387
[Parameter]
372388
[Category(CategoryTypes.FormComponent.ListAppearance)]
373389
public Origin TransformOrigin { get; set; } = Origin.TopCenter;
374390

375391
/// <summary>
376392
/// If false, combobox allows value from out of bound.
377393
/// </summary>
394+
/// <remarks>The default is <c>true</c></remarks>
378395
[Parameter]
379396
[Category(CategoryTypes.FormComponent.Behavior)]
380397
public bool Strict { get; set; } = true;
@@ -396,6 +413,7 @@ protected internal void SetSearchString(T value)
396413
/// <summary>
397414
/// If true, the search-box will be focused when the dropdown is opened.
398415
/// </summary>
416+
/// <remarks>The default is <c>true</c></remarks>
399417
[Parameter]
400418
[Category(CategoryTypes.List.Behavior)]
401419
public bool SearchBoxAutoFocus { get; set; } = true;
@@ -412,7 +430,7 @@ protected internal void SetSearchString(T value)
412430
/// </summary>
413431
[Parameter]
414432
[Category(CategoryTypes.FormComponent.ListBehavior)]
415-
public bool LockScroll { get; set; } = false;
433+
public bool LockScroll { get; set; }
416434

417435
/// <summary>
418436
/// Button click event for clear button. Called after text and value has been cleared.
@@ -422,6 +440,7 @@ protected internal void SetSearchString(T value)
422440
/// <summary>
423441
/// Custom indeterminate icon.
424442
/// </summary>
443+
/// <remarks>The default is <see cref="Icons.Material.Filled.IndeterminateCheckBox"/></remarks>
425444
[Parameter]
426445
[Category(CategoryTypes.FormComponent.ListAppearance)]
427446
public string IndeterminateIcon { get; set; } = Icons.Material.Filled.IndeterminateCheckBox;

ComponentViewer.Docs/Pages/Examples/ComboboxExample2.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
<MudGrid>
55
<MudItem xs="12" sm="8" Class="d-flex gap-4 align-center justify-center">
66
<MudComboBox @bind-Value="@_value" @bind-Text="@_text" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled"
7-
Label="Single Selection" HelperText="Standard combobox" Editable="_editable" autocomplete="new-password">
7+
Label="Single Selection" HelperText="Standard combobox" Editable="_editable" autocomplete="new-password" Clearable>
88
<MudComboBoxItem Value="@("Foo")" Text="Foo">Foo</MudComboBoxItem>
99
<MudComboBoxItem Value="@("Bar")" Text="Bar">Bar</MudComboBoxItem>
1010
<MudComboBoxItem Value="@("Fizz")" Text="Fizz">Fizz</MudComboBoxItem>
1111
<MudComboBoxItem Value="@("Buzz")" Text="Buzz">Buzz</MudComboBoxItem>
1212
</MudComboBox>
1313
<MudComboBox @bind-Value="@_value" @bind-Text="@_text" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" ToggleSelection="true"
14-
Label="Toggle Selection" HelperText="Can unselect the item" Editable="_editable" autocomplete="new-password">
14+
Label="Toggle Selection" HelperText="Can unselect the item" Editable="_editable" autocomplete="new-password" Clearable>
1515
<MudComboBoxItem Value="@("Foo")" Text="Foo">Foo</MudComboBoxItem>
1616
<MudComboBoxItem Value="@("Bar")" Text="Bar">Bar</MudComboBoxItem>
1717
<MudComboBoxItem Value="@("Fizz")" Text="Fizz">Fizz</MudComboBoxItem>
1818
<MudComboBoxItem Value="@("Buzz")" Text="Buzz">Buzz</MudComboBoxItem>
1919
</MudComboBox>
2020
<MudComboBox @bind-Value="@_value" @bind-Text="@_text" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" MultiSelection="true"
21-
Label="Multi Selection" HelperText="Can select multiple items" Editable="_editable" autocomplete="new-password">
21+
Label="Multi Selection" HelperText="Can select multiple items" Editable="_editable" autocomplete="new-password" Clearable>
2222
<MudComboBoxItem Value="@("Foo")" Text="Foo">Foo</MudComboBoxItem>
2323
<MudComboBoxItem Value="@("Bar")" Text="Bar">Bar</MudComboBoxItem>
2424
<MudComboBoxItem Value="@("Fizz")" Text="Fizz">Fizz</MudComboBoxItem>

ComponentViewer.Docs/Pages/Examples/ComboboxExample5.razor

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<MudItem xs="12" sm="8" Class="d-flex gap-4 justify-center">
66
<MudGrid>
77
<MudItem xs="12" Class="d-flex gap-4 justify-center">
8-
<MudComboBox @bind-Value="@_value" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" Label="Text" InputPresenter="ValuePresenter.Text" MultiSelection="_multiselection">
8+
<MudComboBox @bind-Value="@_value" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" Label="Text" InputPresenter="ValuePresenter.Text" MultiSelection="_multiselection" Clearable>
99
<ChildContent>
1010
@foreach (var item in characters)
1111
{
@@ -14,7 +14,7 @@
1414
</ChildContent>
1515
</MudComboBox>
1616

17-
<MudComboBox @bind-Value="@_value" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" Label="Chip" InputPresenter="ValuePresenter.Chip" MultiSelection="_multiselection">
17+
<MudComboBox @bind-Value="@_value" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" Label="Chip" InputPresenter="ValuePresenter.Chip" MultiSelection="_multiselection" Clearable>
1818
<ChildContent>
1919
@foreach (var item in characters)
2020
{
@@ -25,7 +25,7 @@
2525
</MudItem>
2626

2727
<MudItem xs="12" Class="d-flex gap-4 justify-center">
28-
<MudComboBox @bind-Value="@_value" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" Label="InputContent" InputPresenter="ValuePresenter.ItemContent" MultiSelection="_multiselection">
28+
<MudComboBox @bind-Value="@_value" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" Label="InputContent" InputPresenter="ValuePresenter.ItemContent" MultiSelection="_multiselection" Clearable>
2929
<ChildContent>
3030
@foreach (var item in characters)
3131
{
@@ -36,7 +36,7 @@
3636
</ChildContent>
3737
</MudComboBox>
3838

39-
<MudComboBox @bind-Value="@_value" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" Label="Input&ItemContent" InputPresenter="ValuePresenter.ItemContent" ItemPresenter="ValuePresenter.ItemContent" MultiSelection="_multiselection">
39+
<MudComboBox @bind-Value="@_value" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" Label="Input&ItemContent" InputPresenter="ValuePresenter.ItemContent" ItemPresenter="ValuePresenter.ItemContent" MultiSelection="_multiselection" Clearable>
4040
<ChildContent>
4141
@foreach (var item in characters)
4242
{
@@ -49,7 +49,7 @@
4949
</MudItem>
5050

5151
<MudItem xs="12">
52-
<MudComboBox MultiSelectionTextFunc="@(new Func<List<string>, string>(GetMultiSelectionText))" MultiSelection="_multiselection" @bind-Value="@_value" @bind-SelectedValues="@_selectedValues" T="string" Label="Text Func" Variant="Variant.Filled" Placeholder="Placeholder">
52+
<MudComboBox MultiSelectionTextFunc="@(new Func<List<string>, string>(GetMultiSelectionText))" MultiSelection="_multiselection" @bind-Value="@_value" @bind-SelectedValues="@_selectedValues" T="string" Label="Text Func" Variant="Variant.Filled" Placeholder="Placeholder" Clearable>
5353
@foreach (var item in characters)
5454
{
5555
<MudComboBoxItem T="string" Value="@item" Text="@item">@item</MudComboBoxItem>

ComponentViewer.Docs/Pages/Examples/ComboboxExample6.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<MudGrid>
55
<MudItem xs="12" sm="8" Class="d-flex flex-column gap-4 justify-center">
66
<MudComboBox @bind-Value="@_stringValue" @bind-SelectedValues="@_stringSelectedValues" Variant="Variant.Filled" Label="String Type" InputPresenter="ValuePresenter.Chip" MultiSelection="_multiselection"
7-
ChipCloseable="_chipCloseable" ChipSize="_chipSize" ChipVariant="_chipVariant" Color="_color">
7+
ChipCloseable="_chipCloseable" ChipSize="_chipSize" ChipVariant="_chipVariant" Color="_color" Clearable>
88
<ChildContent>
99
@foreach (var state in states)
1010
{
@@ -14,7 +14,7 @@
1414
</MudComboBox>
1515

1616
<MudComboBox @bind-Value="@_intValue" @bind-SelectedValues="@_intSelectedValues" Variant="Variant.Filled" Label="Int Type" InputPresenter="ValuePresenter.Chip" MultiSelection="_multiselection"
17-
ChipCloseable="_chipCloseable" ChipSize="_chipSize" ChipVariant="_chipVariant" Color="_color">
17+
ChipCloseable="_chipCloseable" ChipSize="_chipSize" ChipVariant="_chipVariant" Color="_color" Clearable>
1818
<ChildContent>
1919
@foreach (var num in _numbers)
2020
{
@@ -24,7 +24,7 @@
2424
</MudComboBox>
2525

2626
<MudComboBox @bind-Value="@_complexValue" @bind-SelectedValues="@_complexSelectedValues" Variant="Variant.Filled" Label="Complex Type" InputPresenter="ValuePresenter.Chip" MultiSelection="_multiselection"
27-
ChipCloseable="_chipCloseable" ChipSize="_chipSize" ChipVariant="_chipVariant" Color="_color" ToStringFunc="@(e => e?.Id + " - " + e?.Name)">
27+
ChipCloseable="_chipCloseable" ChipSize="_chipSize" ChipVariant="_chipVariant" Color="_color" ToStringFunc="@(e => e?.Id + " - " + e?.Name)" Clearable>
2828
<ChildContent>
2929
@foreach (var item in _complexItems)
3030
{

ComponentViewer.Docs/Pages/Examples/ComboboxExample8.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
<MudGrid>
55
<MudItem xs="12" Class="d-flex gap-4 align-center justify-center">
6-
<MudComboBox @bind-Value="@_value" @bind-Text="@_text" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled"
6+
<MudComboBox @bind-Value="@_value" @bind-Text="@_text" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" Clearable
77
Label="Standard (Contains)" Editable="true" autocomplete="new-password">
88
<MudComboBoxItem Value="@("Foo")" Text="Foo">Foo</MudComboBoxItem>
99
<MudComboBoxItem Value="@("Bar")" Text="Bar">Bar</MudComboBoxItem>
1010
<MudComboBoxItem Value="@("Fizz")" Text="Fizz">Fizz</MudComboBoxItem>
1111
<MudComboBoxItem Value="@("Buzz")" Text="Buzz">Buzz</MudComboBoxItem>
1212
</MudComboBox>
13-
<MudComboBox @bind-Value="@_value" @bind-Text="@_text" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" ToggleSelection="true"
13+
<MudComboBox @bind-Value="@_value" @bind-Text="@_text" @bind-SelectedValues="@_selectedValues" Variant="Variant.Filled" ToggleSelection="true" Clearable
1414
Label="Custom (StartsWith)" Editable="true" SearchFunc="@(new Func<string, string, string, bool>(SearchStartWith))" autocomplete="new-password">
1515
<MudComboBoxItem Value="@("Foo")" Text="Foo">Foo</MudComboBoxItem>
1616
<MudComboBoxItem Value="@("Bar")" Text="Bar">Bar</MudComboBoxItem>

0 commit comments

Comments
 (0)