Skip to contentKino
Skip to Content

Tag input

A field that turns what you type into tags, with suggestions as you type and a pasted list split into tags.

npx shadcn add https://kinoui.com/r/tag-input.json
Share on

Examples

Topics

Default

Pick a suggestion, or type a tag and press Enter or a comma. A tag typed again is pointed out instead of added twice.

Alert keywords

Typed only

Without suggestions, no list opens and any text becomes a tag. Paste “latency, timeout, 502” for three at once.

Add at least one topic.

In a form

In a Field, its label names the input and an invalid field marks it, with the error under it.

Installation

npx shadcn@latest add https://kinoui.com/r/tag-input.json
Files
lib/reduce-motion.tslib/scroll.tslib/refs.tslib/resize.tslib/swap.tsxlib/popup.tslib/glide.tsxcomponents/kino/tooltip.tsxlib/cut.tsxcomponents/kino/input.tsxcomponents/kino/label.tsxcomponents/kino/spinner.tsxcomponents/kino/button.tsxcomponents/kino/separator.tsxlib/run-progress.tslib/highlight.tslib/menu.tsxcomponents/kino/select.tsxlib/filter-list.tsxlib/chip.tsxlib/flow.tscomponents/kino/combobox.tsxlib/announce.tsxlib/controllable.tscomponents/kino/tag-input.tsx
Packages
@base-ui/reactclass-variance-authority

New to Kino? Installation covers what your project needs first and the @kino namespace.

API reference

TagInput

PropTypeDefaultDescription
suggestionsstring[]NoneTags to offer as you type. Without them, no list opens and any text becomes a tag.
defaultValuestring[]NoneThe tags at first, when you leave the state to the field.
valuestring[]NoneThe tags, when you hold the state.
onValueChange(tags, details?) => voidNonedetails is Base UI’s when it made the change (a row picked, a tag removed), and undefined for a tag added with a comma, a paste or by leaving the field.
defaultInputValuestring''The text typed at first, when you leave it to the field.
inputValuestringNoneThe text typed, when you hold the state.
onInputValueChange(text, details?) => voidNoneCalled as the typed text changes; details is undefined when adding a tag empties it.

TagInputValue

PropTypeDefaultDescription
children(tag) => ReactNodeNoneWhat a chip shows, when not the tag itself.

TagInputChip

PropTypeDefaultDescription
tagstringNoneThe tag it shows.

TagInputList

PropTypeDefaultDescription
children(tag) => ReactNodeNoneA row of your own for each suggestion, when not TagInputItem.

Accessibility

  • The input is a combobox and the suggestions a listbox: arrow keys move the highlight, Enter picks, and Escape closes the list.
  • Escape on a closed field lets go of the typed text and keeps every tag.
  • Each tag added or removed is read out, and so is a tag typed again: “Billing is already added”.
  • Name it with a Field and its label, or aria-label on the input. Each remove button is named after its tag.
  • When the system asks for less motion, tags move to their new places at once and only fade.