Inputs
TagsInput
The TagsInput turns free text into a list of short values: the user types a tag, confirms it with Enter (or with a separator of your own), and it becomes a removable chip in front of the input. It binds to a collection of strings, offers known values through the browser's own suggestion list - or accepts nothing else - splits a pasted list into a tag each, and keeps the entries in shape on the way in: trimming, transforming, capping their length and their number, and rejecting the ones that repeat, that are too short, that fail a pattern or that a validator turns down, each rejection reported with the rule that caused it. The chips form a proper accessible list: one stop of the tab order that the arrow keys walk through, removable with Delete, correctable in place, movable by drag, by two taps on the handle a chip grows or with Alt and the arrows, with the ones a predicate pins in place carrying no dismiss button at all, and with every change announced to screen readers. It comes in three sizes, three variants and the whole accent palette, folds a long list away behind a chip, carries a label, a helper text, a prefix, a suffix, a counter, a clear button and a spinner for the suggestions it is still fetching, can be driven entirely from code, and takes part in an EditForm like any other input.
Forms, events & API
Binding the list of tags with form validation, the events that can cancel or correct a change, and driving the field from code.
Binding, forms & validation
aria-invalid and turns its
description red - the annotations that apply being the collection ones. Enter confirms a tag, so it is
held back from submitting the form; CancelConfirmKeysOnEmpty hands it back once there is nothing
left to confirm. Name posts the whole list as a single field of a plain HTML form, the tags
joined by the first separator.
Events
Public API
Feedback
Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.