Skip to content

Tag input

<ax-tag-input> turns free text into removable chips. It implements ControlValueAccessor over string[] (works with [(ngModel)] / formControlName) and exposes a two-way [(value)]. For choosing from a fixed option list instead, use the Combobox chips / MultiSelect.

import { AxTagInputComponent } from '@axisui-ng/forms';
<ax-tag-input [(value)]="tags" placeholder="Add a tag…" [max]="5" ariaLabel="Tags" />
<!-- reactive forms -->
<ax-tag-input formControlName="tags" ariaLabel="Tags" />
InputTypeDefaultNotes
valuemodel<string[]>[]Two-way; also driven by forms via CVA.
placeholderstring''Text-field placeholder.
maxnumber | nullnullCap on the number of tags (null = unlimited).
allowDuplicatesbooleanfalsePermit repeated tags.
disabledbooleanfalseAlso set by setDisabledState from a form.
ariaLabelstring''Labels the group + the text field (field falls back to 'Add tag').
ActionResult
Enter or commaAdds the trimmed draft as a tag (deduped unless allowDuplicates, capped by max).
Backspace (empty field)Removes the last tag.
PasteSplits on commas/newlines and adds each token.
Chip ×Removes that tag.

A labelled group containing a labelled text input and removable chips (each × is labelled Remove {tag}). Add/remove/rejection messages go to an aria-live="polite" region.

Interactive examples live in Storybook under Forms / TagInput. Run pnpm storybook to explore them.