ChipsInput
Recipient chips input: chips and a borderless input share a single control box. Pasting multiple addresses auto-splits on semicolons / commas / newlines / whitespace; Enter / , / ; commits a chip; invalid emails get a red outline and emit oas-invalid (submission is not blocked — the host decides on controlled data).
Basic usage
Email scenario
value is dual-channel: the property is a string array, the attribute is a JSON-serialized string. Press Enter / , / ; to commit the current text as a chip; placeholder falls back to the i18n message when absent.
Paste auto-split
Paste multi-address text split on semicolons/commas/newlines/whitespace
When pasted text contains separators (semicolon / comma / newline / whitespace), it is split, trimmed, and committed as chips in batch (each piece goes through dedup / max / email validation); paste without separators keeps native insertion. A batch addition emits one oas-change (trigger = "paste").
Backspace to edit
Backspace on empty input edits the previous chip
With an empty input, Backspace turns the last chip into editable text (focused and selected): Enter / blur commits, Esc cancels and restores, committing an empty value removes the chip. The × button on a chip removes it individually.
Inline email validation
Invalid email: red outline + oas-invalid (submission not blocked)
- Invalid email chips are still created (submission is not blocked — the host decides on controlled data), with a red outline (danger token), a
titletooltip, and an inline hint - Emits
oas-invalid(detail: { value, index }); idempotent: only user-interaction paths emit — re-renders and programmaticvaluewrites do not re-emit - The validation uses a pragmatic email regex (not full RFC 5322 coverage); hosts can listen to
oas-invalidand decide on their own
max limit
max=3: exceeding emits oas-exceed-limit and blocks additions
Once max is reached, further additions emit oas-exceed-limit (detail: { value, max }) with an inline hint and are not added; existing chips can still be removed.
Duplicate handling
Duplicate values are silently dropped (no new chip, no oas-add), with a single dev-only warning per component instance (stripped in production). Committing an edit that duplicates another chip is likewise silently restored.
disabled / readonly / size
disabled / readonly
size
disabled: the input and remove buttons are disabled; the control box is desaturated (reads the injected global disabled state)readonly: chips are display-only; the input and remove buttons are hidden (distinct form semantics from disabled)size:small/medium(default) /large; the control box height follows the--oas-control-height-*tokens
Events
Add / remove / edit event feedback
oas-change carries detail: { value, trigger } with trigger ∈ add | remove | edit | paste; also available: oas-add / oas-remove (detail: { value, index }), oas-invalid, oas-exceed-limit, oas-focus / oas-blur:
ChipsInput vs DynamicTags
Both are "free input becomes chips" components with different interaction models: DynamicTags is a tag flow plus a persistent input below (sorting / collapse / custom tag templates); ChipsInput keeps chips inline in a single control box (a single-control mental model close to a native input) with built-in per-chip email validation and red outlines. Use ChipsInput for recipient / email sets; use DynamicTags for generic tags (keywords, categories) that need sorting / collapsing / template customization.
Framework binding note: the value attribute channel takes a JSON string; for dynamic binding in host frameworks (e.g. Vue :value="..."), pass a string array via the property channel — do not dynamically patch the attribute with a raw string, which normalizes to an empty array.
API
oas-chips-input
Attributes
| Attribute | Description | Type | Default |
|---|---|---|---|
disabled | Disabled | boolean | — |
max | Chip count limit; exceeding emits oas-exceed-limit and blocks additions | string | — |
name | Form field name (key collected by oas-form; the component is not form-associated and is not submitted via native FormData) | — | — |
placeholder | Input placeholder (i18n default) | string | — |
readonly | Readonly (chips are display-only) | boolean | — |
size | Size: small / medium / large | string | medium |
value | Email chip array (property or JSON attribute) | string[] | [] |
Property (JS property; see each row for attribute reflection)
| Property | Description | Type | Default |
|---|---|---|---|
value | Current value: email string array (writing back to the value attribute emits no events) | string[] | [] |
Events
| Event | Description |
|---|---|
oas-add | Dispatched when a chip is added, detail: { value, index } |
oas-blur | Dispatched when the input is blurred |
oas-change | Dispatched after chips are added/removed/edited, detail: { value, trigger }, trigger ∈ add | remove | edit | paste |
oas-exceed-limit | Dispatched when exceeding the max limit; addition is blocked, detail: { value, max } |
oas-focus | Dispatched when the input is focused |
oas-invalid | Dispatched when a chip fails email validation (idempotent: user-interaction paths only; submission not blocked), detail: { value, index } |
oas-remove | Dispatched when a chip is removed, detail: { value, index } |
Keyboard: Enter / , / ; commits a chip; Backspace on empty input edits the previous chip; in edit mode Enter commits / Esc cancels.
ARIA: chips container role="list", chip role="listitem", input and remove buttons carry i18n aria-labels, hint area role="alert"; the host carries aria-readonly when readonly.