ShellUI Logo
ShellUI

Tag Input

Free-text tags with keyboard and paste support

TagInput lets users type free-text tags. Press Enter or type a separator (, ; tab or newline) to add a tag, and Backspace in an empty field to remove the last one. Pasting text splits it on the separators. Duplicates are ignored (case-insensitive) unless AllowDuplicates is set.

Installation

shellui add tag-input

Usage

<TagInput @bind-Tags="_tags" Placeholder="Add a skill..." />

<p>@string.Join(", ", _tags)</p>

@code {
    private List<string> _tags = new() { "blazor", "tailwind" };
}

Limits and separators

<TagInput @bind-Tags="_emails" MaxTags="5" Separators='new[] { ",", " " }'
    Placeholder="Up to 5 emails" />

@code {
    private List<string> _emails = new();
}

API Reference

PropertyTypeDefaultDescription
TagsList<string>empty listThe tags (supports @bind-Tags)
TagsChangedEventCallback<List<string>>—Raised when a tag is added or removed
Placeholderstring"Add tag..."Input placeholder
MaxTagsint?nullMaximum number of tags
AllowDuplicatesboolfalseAllow the same tag more than once
Separatorsstring[], ; \t \nStrings that complete a tag while typing or pasting
DisabledboolfalseDisables the input
Classstring?nullAdditional CSS classes

On this page