Created
September 17, 2021 22:23
-
-
Save pawelel/e6ee2bc7591e23ec57a80704d5b15c1d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<MudContainer Class="pa-4" style="border:1px solid grey"> | |
@foreach(var c in chips){ | |
<MudChip Text="@c" OnClose="Remove"></MudChip> | |
} | |
<MudTextField T="string" TextChanged="Add"/> | |
</MudContainer> | |
@code { | |
private List<string> chips {get;set;} = new(); | |
private void Add(string value){ | |
chips.Add(value); | |
StateHasChanged(); | |
} | |
private void Remove(MudChip chip) { | |
var value = chips.First(x=> x.Equals(chip.Text)); | |
chips.Remove(value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment