InputTags

InputTags is used to enter multiple tags.

Vue
JavaScript
PREVIEW

InputTags is used to enter multiple tags. Press Enter to add a tag and Backspace to remove the last one.

Vue
basic-demo

A custom delimiter like a comma can be used in addition to the Enter key to add tags. Enable addOnPaste to split pasted text using the delimiter.

delimiter-demo

By default, duplicate values are not allowed. Set allowDuplicate to enable adding the same value multiple times.

a
A
a
allow-duplicate-demo

The maximum number of tags is limited using the max property.

Vue
React
max-demo

Custom content can be displayed for each tag using the chip slot.

JavaScript TypeScript
template-demo

When typeahead is enabled, a dropdown with suggestions is displayed as the user types. Define a suggestions array along with optionLabel to specify the display field. For grouped suggestions, use optionGroupLabel and optionGroupChildren properties. The complete event is triggered on input change, enabling dynamic filtering and updating of suggestions.

No results found
typeahead-demo

Use add and remove callbacks to listen for tag changes.

Vue
Event Log
events-demo

A floating label appears on top of the input field when focused.

float-label-demo

IftaLabel is used to create infield top aligned labels. Visit IftaLabel documentation for more information.

ifta-label-demo

Specify the variant property as filled to display the component with a higher visual emphasis than the default outlined style.

Vue
filled-demo

When disabled is present, the element cannot be edited and focused.

Vue
disabled-demo

The invalid property is used to indicate an invalid state.

invalid-demo

InputTags integrates seamlessly with the PrimeVue Forms library.

forms-demo

Screen Reader

The container of the chip list uses listbox role with aria-orientation set to horizontal. The aria-label and aria-labelledby props can be used to describe the component.

When typeahead is enabled, the input element has combobox role in addition to aria-autocomplete, aria-haspopup and aria-expanded attributes. The relation between the input and the popup is created with aria-controls and aria-activedescendant is used to instruct the screen reader which option to read during keyboard navigation within the popup list. A live region with aria-live set to polite announces the number of available results, and the input is linked to it via aria-describedby.

Keyboard Support

KeyFunction
tabMoves focus to the input element.
enterAdds a new tag with the current input value.
backspaceRemoves the last tag when input is empty.
left arrowMoves focus to the previous tag when input is empty.
right arrowMoves focus to the next tag when focused on a tag.

Tag Keyboard Support

KeyFunction
backspaceRemoves the focused tag.
deleteRemoves the focused tag.

Popup Keyboard Support (Typeahead)

KeyFunction
tabSelects the focused option and closes the popup, then moves focus to next element in page.
enterSelects the focused option and closes the popup.
escapeCloses the popup.
down arrowMoves focus to the next option.
up arrowMoves focus to the previous option.
homeMoves focus to the first option.
endMoves focus to the last option.
Theme Designer