Skip to content
kapable

TagInput

Forms · 2 exports · v0.1.0 · showcase

Repeated hidden form values enhanced with removable tag chips and text entry.

Browse 72 component families

TagInput depends on client keyboard handling to commit and remove repeated form values. This server-rendered page does not imitate client behavior. Open the live playground.

Usage

TagInput usage
<TagInput label="Labels" name="labels" defaultValue={['infra']} />

API

TagInput API

TagInputProps

Tags as PROGRESSIVE ENHANCEMENT over repeated form fields: every committed tag is a chip backed by `<input type="hidden" name={name}>`, and the entry input carries `name` too — so the server always receives the same field, as repeated values and/or comma-separated text, and `parseTags(formData.getAll(name))` flattens every path. JS-off: chips from `defaultValue` render static and the entry input still ADDS tags (comma-separated); removal is island behavior (Enter/comma commits, Backspace on an empty entry removes the last chip, × removes any).

TagInput props
proptypenotes
labelstring
namestringForm field name — repeated per chip, plus the entry input.
defaultValue?string[]Initial tags (server-known).
placeholder?string
hint?stringMachine-register hint; default explains the keys.
removeLabel?(tag: string) => stringi18n: per-chip remove label (default `Remove ${tag}`).
mix?MixInput

More in Forms

More in Forms