Skip to content

Instantly share code, notes, and snippets.

@pawelel
Created September 17, 2021 22:23
Show Gist options
  • Save pawelel/e6ee2bc7591e23ec57a80704d5b15c1d to your computer and use it in GitHub Desktop.
Save pawelel/e6ee2bc7591e23ec57a80704d5b15c1d to your computer and use it in GitHub Desktop.
<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