Skip to content
Advertisement

Blazor autocomplete tagging

Similar to this question, I am looking for a component to add tags to an object like in stackoverflow, meaning autocomplete text field for tags. I am either looking for a native component or a way to wrap a JS solution so that it can be used in blazor.

Another idea is a multi-select component with checkboxes like discussed here, but I do not really like the idea.

Ideally I would provide a list of all tags and bind to a list on an item for which the tags are being set.

Advertisement

Answer

Usually, it’s not right practice to share full code as SO is not a code sharing site and it’s generally asked What you have tried so far?. However since Blazor is a new technology thus beginners struggle with finding a good solution or a plugin on web to meet their requirement thus I’m considering this as an exception.

Now answer to your question Creating a new component for adding tags. You can use below solution that I created in one of the project I’m working on. This doesn’t require any JS and can be handled with C# only to create a Tag. You can also check the Blazor Fiddle solution in action that I have prepared for you on fiddle. Hope this is what you are looking for.

JavaScript

P.S. What I’ve shared here is only a code snippet of building tags, it doesn’t not contain tags with autocomplete option as it would require time to create a full solution on fiddle with fake data. Thus I’m avoiding that due to time limitation.

Advertisement