Skip to content

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.

design
accessibility

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.
ana@example.com

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.

design

Rejected: —

A maximum

Past max the input goes read-only rather than disappearing, so the field keeps its label and its focus target.

one
two

Remove one to type again.

Clearable

draft
urgent

Sizes

The field and its tags scale together.

small
medium
large

Invalid

not-an-email

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

PropTypeDefaultDescription
modelValuestring[][]
placeholderstring
maxnumberStop accepting tags past this many
delimiterstring | RegExp','What ends a tag, and what a paste is split on
duplicatebooleanfalseAllow the same tag twice
addOnPastebooleanfalseSplit a pasted string into tags
addOnTabbooleanfalseCommit the typed text on Tab
addOnBlurbooleanfalseCommit the typed text when focus leaves
clearablebooleanfalseShow a control that empties the field
disabledbooleanfalse
invalidbooleanInherited from IFormField when unset
size'sm' | 'md' | 'lg''md'
unstyledbooleanSkip built-in classes
ui{ root?, tag?, tagText?, tagDelete?, input?, clear? }Per-slot class overrides

Events

EventPayloadDescription
update:modelValuestring[]
addTagstringA tag was added
removeTagstringA tag was removed
invalidTagstringA tag was refused — a duplicate, or one past max

Slots

SlotPropsDescription
tag{ tag }Replaces a tag's contents, including its delete control
clearReplaces 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.