Forms

Tag input

@xui/tag-input

A token/chip input. Type and press Enter (or the separator) to add a tag; click a tag's ✕ or press Backspace on an empty field to remove one. Paste splits on the separator. [(values)] two-way binding and ControlValueAccessor.

Install

pnpm add @xui/tag-input

Add the barrel to a standalone component's imports:

import { XuiTagInputImports } from '@xui/tag-input';

@Component({
  imports: [XuiTagInputImports],
  // …
})

Examples

Default

Loading preview…

Empty

Loading preview…

Add on blur with duplicates

Loading preview…

Disabled

Loading preview…

API

XuiTagInput

componentxui-tag-input

A token/chip input: type and press Enter (or the separator) to add a tag, click a tag's ✕ or press Backspace on an empty field to remove one. [(values)] two-way binding and ControlValueAccessor over a string[].

Variants

AxisOptionsDefaultfilltruefalsefalse

Inputs

NameTypeDefaultclassClassValueExtra classes, merged into the component's own rather than replacing them.''valuestwo-waystring[]The current tags. Two-way bindable with [(values)].[]placeholderstringText shown in the empty field. Hidden once there is at least one tag.''fillbooleanStretch to the available width instead of hugging its contents.falsedisabledbooleanBlock interaction and dim the field and its tags.falseseparatorstringCharacter that also commits the current draft (besides Enter).','addOnBlurbooleanCommit the draft when the field loses focus.falseaddOnPastebooleanSplit pasted text on the separator and add each piece.trueallowDuplicatesbooleanReject a tag that already exists.false

Outputs

NameTypeaddedstringEmits each tag as it is added.removedstringEmits each tag as it is removed.

Source

libs/ui/tag-input/xui

xUI 2.0.0 — Apache 2.0 licensed. Built with Angular and Tailwind CSS.