Input chips
vig-input-chips
import { InputChips } from '@vigdx/ui/input-chips';Basic
[(value)] holds the entries as a string[] . Entries are trimmed and a duplicate stays in the field as typed, with a message ( allowDuplicates accepts it; entryKey decides what counts as the same entry, by default the text in Unicode NFC). Only the entry a typed separator ends is added; the rest of the field is left as it is. Backspace in the empty field steps onto the last chip, the arrow keys move between chips, and Backspace or Delete removes the focused one.
Value: [ "angular", "signals" ]
Separators, limits and validation
separators lists the characters that end an entry as it is typed or pasted (a comma by default); a paste of several lines adds each line. maxLength stops at a count, validator returns true , false or a message, and addOnBlur adds the text when focus leaves. Rejected entries stay in the field and the message shows under it.
Up to five addresses; paste a list to add them all.
Signal Forms
[formField] . Counts are minLength and maxLength on the array; a schema's maxLength also binds the field's own, so further entries are refused as they are typed.
Two to four keywords.
Reactive Forms
VigValueAccessor next to the field for formControlName , formControl and ngModel . A reset writes [] and drops the typed text.
Styling hooks
Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="input-chips"][data-part="field"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.
Scope: [data-scope="input-chips"]
| Part | Element | data-state |
|---|---|---|
field | — | |
label | <label> . | — |
control | — | |
chip | vig-chip per entry; style its own parts ( data-scope="chip" ). | — |
input | <input> . | — |
clear | clearable ). | — |
status | role="status" region announcing changes. | — |
hint | vig-hint (a display: contents host; style its text part). | — |
disabled-reason | vig-hint with the disabled reason ( display: contents ). | — |
error | vig-field-error (a display: contents host; style its message part). | — |
Accessibility
- The field is a native text input with a
<label>; it is described by the entries (read after its name), the hint and the error. Each chip is avig-chipwhose remove button is named "Remove" and the entry. - Additions, removals and rejections are announced through a polite status region (one message for a paste of several entries).
- Typing with an input method (Japanese, Chinese, Korean…) is never split or committed while a composition is open: Enter confirms the composition, not the entry.
- The field is the only Tab stop: Backspace in the empty field, or the arrow keys at its start (mirrored in right-to-left pages), move onto the chips' remove buttons, and the arrow keys, Home and End move between them. Removing with a key moves on to the next chip; removing with the pointer keeps focus in the field.
- Texts are translated with the locale or per instance through
labels(removeAriaLabel,clearAriaLabel, the announcements and the duplicate, limit and invalid messages).
API
InputChips
vig-input-chipsA text field that turns what is typed into removable chips, for tags,
e-mail recipients or keywords. Enter, a separators character (a comma by
default) or a paste of several lines adds entries; Backspace in the empty
field steps onto the last chip, and the arrow keys move between chips,
where Backspace or Delete removes one. The value is the entries, in order.
<vig-input-chips label="Tags" [formField]="form.tags" />Entries are trimmed; duplicates, entries past maxLength and entries the
validator rejects stay in the field with a message. Typing with an IME
is never split mid-composition. Additions and removals are announced
politely. Works with Signal Forms and, through VigValueAccessor, with
Reactive Forms and ngModel. A schema's maxLength stops further entries;
minLength and required validate the array as usual.
| Name | Type | Default | Description |
|---|---|---|---|
addOnBlur | boolean | false | Leaving the field adds what was typed (when it is accepted). |
allowDuplicates | boolean | false | Accepts an entry that is already a chip (compared by |
clearable | boolean | false | Shows a button that removes every chip. |
dirty | boolean | false | — |
disabled | boolean | false | — |
disabledReasons | readonly WithOptionalFieldTree<DisabledReason>[] | [] | — |
entryKey | (entry: string) => string | nfc | What makes two entries the same for the duplicate check, e.g.
|
errorMessages | Record<string, string> | — | — |
errors | readonly ValidationError.WithOptionalFieldTree[] | [] | — |
hidden | boolean | false | — |
hideLabel | boolean | false | Visually hides the label, which still names the field; pair it with a placeholder. |
hint | string | undefined | undefined | — |
invalid | boolean | false | — |
label | string | — | — |
labelPosition | LabelPosition | 'float' |
|
labels | Partial<InputChipsLabels> | — | Texts (i18n); locale defaults. |
maxLength | number | undefined | undefined | At most this many entries; further ones stay in the field with a
message. The Signal Forms name of the array's length limit, so a schema's
|
name | string | '' | — |
pending | boolean | false | — |
placeholder | string | undefined | undefined | Shown in the empty field while there are no chips. |
readonly | boolean | false | — |
required | boolean | false | — |
separators | readonly string[] | [','] | Characters that end an entry as it is typed or pasted, besides Enter. |
size | FieldSize | 'md' | — |
touched | boolean | false | — |
validator | InputChipsValidator | undefined | undefined | Checks each entry before it becomes a chip; see |
value | string[] | [] | The entries, in order; |
| Name | Payload | Description |
|---|---|---|
touch | void | — |
valueChange | string[] | The entries, in order; |
| Signature | Description |
|---|---|
focus(options?: FocusOptions): void | Moves focus to the control's interactive element (the input, or the
trigger of a popup control). Signal Forms calls it through
|
reset(): void | Drops typed text and messages; see |