str:<span>@str</span><br>
<TagsInput @ref="tinput" @bind-Value="str" Options="opts"></TagsInput><br>
<Button Color="Color.Primary" @onclick="clear">Clear</Button>
@code{
string str = "aa,bb";
TagsInput tinput;
TagsInputOptions opts = new() {MaxTags = 5,
Source=new []{"aa","bb","cc","dd","eee","ff"},
Removable =true};
void clear()
{
tinput.Flush(); //or tinput.RemoveAll();
}
}
参数名 | 类型 | 描述 | 默认值 |
---|---|---|---|
AllowDuplicates | bool? | When true, the same tag can be added multiple times. | false |
CaseSensitive | bool? | When true, duplicate tags value check is case sensitive. | true |
ClearSelectionOnTyping | bool? | When true, tags will be unselected when new tag is entered. | false |
CloseDropdownOnItemSelect | bool? | When true, datalist will close automatically after an item have been selected. | true |
Delimiter | string | Multiple tags can be added at once. Delimiter is used to separate all tags | , |
FreeInput | bool? | When true, tags can be entered manually. This option is useful with select Tags inputs. Set to false automatically when using on select element. | true |
HighlightDuplicate | bool? | When true, if allowDuplicates option if false then the already existing tag will be temporarly and visually identified as duplicate | true |
HighlightMatchesString | bool? | When true, identified matches strings when searching is highlighted. | true |
MaxTags | int? | When set, no more than the given number of tags are allowed to add. | null |
MaxChars | int? | Defines the maximum length of a single tag. | null |
MinChars | int? | Defines the minimum length of a single tag. | 1 |
NoResultsLabel | string | Empty dropdown label. | No results found |
Placeholder | string | TagsInput placeholder text if original input doesn’t have one. | |
Removable | bool? | When true, tags are removable either using the associted delete button or backspace and delete keys. | true |
SearchMinChars | int? | searchMinChars Defines the minimum length of input value before loading auto-complete. | 1 |
Selectable | bool? | When true, tags can be selected either by mouse click or using left or right arrow keys. | true |
Source | IEnumerable<string> | source Source of data proposed in dropdown (used for auto-complete). | |
TagClass | string | Classname applied to each tag. | is-rounded |
Trim | bool? | When true, automatically removes all whitespace around tags. | true |
文档