Forms
ITagsInput
A field that collects a list — labels on an issue, recipients on a message, skills on a profile. Each entry becomes a tag that can be removed on its own.
2 tag(s): design, accessibility
Press Enter to commit a tag, Backspace on an empty field to remove the last one.
Committing a tag
Enter always commits. Three props add the other moments a reader expects a tag to be taken:
add-on-blur— commit what is typed when focus leaves, rather than discarding it.add-on-tab— commit when Tab moves focus along.add-on-paste— split a pasted string on the delimiter instead of taking it as one tag.
The delimiter is a comma by default, so pasting a comma-separated list does the obvious thing. Pass delimiter for something else — a string or a regular expression.
Duplicates
Refused by default. The attempt still emits invalid-tag, so you can say why; duplicate allows them.
Rejected: —
A maximum
Past max the input goes read-only rather than disappearing, so the field keeps its label and its focus target.
Remove one to type again.
Clearable
Sizes
The field and its tags scale together.
Invalid
One of those is not an email address.
Inside an IFormField the invalid state, the id and the error's aria-describedby are inherited.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
modelValue | string[] | [] | |
placeholder | string | — | |
max | number | — | Stop accepting tags past this many |
delimiter | string | RegExp | ',' | What ends a tag, and what a paste is split on |
duplicate | boolean | false | Allow the same tag twice |
addOnPaste | boolean | false | Split a pasted string into tags |
addOnTab | boolean | false | Commit the typed text on Tab |
addOnBlur | boolean | false | Commit the typed text when focus leaves |
clearable | boolean | false | Show a control that empties the field |
disabled | boolean | false | |
invalid | boolean | — | Inherited from IFormField when unset |
size | 'sm' | 'md' | 'lg' | 'md' | |
unstyled | boolean | — | Skip built-in classes |
ui | { root?, tag?, tagText?, tagDelete?, input?, clear? } | — | Per-slot class overrides |
Events
| Event | Payload | Description |
|---|---|---|
update:modelValue | string[] | |
addTag | string | A tag was added |
removeTag | string | A tag was removed |
invalidTag | string | A tag was refused — a duplicate, or one past max |
Slots
| Slot | Props | Description |
|---|---|---|
tag | { tag } | Replaces a tag's contents, including its delete control |
clear | — | Replaces the clear control's contents |
Accessibility
The name you give the field lands on the <input>, and each tag's delete control is named after the tag it removes — "Remove design". Arrow keys move between committed tags, and Backspace from an empty input selects the last one before removing it.
The field grows as tags wrap onto new lines rather than scrolling them out of sight.