Tags input
A field that turns entries into removable chips — hosts, emails, labels.
{/* Generated by scripts/build-component-docs.mjs — do not edit. The source is the component folder: guidance.json, the doc block and the props. Change those. */}
A field that turns entries into removable chips — hosts, emails, labels.
Import
import { InputChip, TagsInput } from "@ir/ui";Props
| Prop | Type | Required | What it does |
|---|---|---|---|
validate | (tag: string) => boolean | Return false to refuse a tag; it stays in the field for correcting. |
Do and don't
Say so in the hint — 'Separate hosts with a comma'.
Don't — Assume people know Enter or a comma makes a tag.
Nothing on screen explains the gesture, and a typed value that never becomes a chip looks saved but is not.
Use validate, which leaves the entry in the field, and show why in the error.
Don't — Silently drop an entry that is not allowed.
A value that vanishes reads as accepted. Left in place, it can be corrected.
Use Select.
Don't — Use tags for choosing from a known list.
Free text invites typos in things that should be exact. Tags are for values the system cannot list.
Accessibility
- Each chip's × is a button named 'Remove <tag>'.
- Backspace in the empty field removes the last tag; Enter, comma and paste add.
Where it is drawn
Figma — structure from figma, measurements from figma.