structyl

Tags Input

stable

An input that collects a list of tags as chips.

Basic usage

reacttailwind

Examples

Controlled with max tags

Cap the tag count and track the value externally.

reacttypescript

2/5 tags

Tag collection

TagsInput supports existing tags, rendered chips, input entry and max-tag workflows.

reacttailwindstorybook

Features

  • Delimiter parsing.
  • Paste-split, max-tags.

Installation

bash
pnpm dlx structyl add tags-input

API Reference

TagsInput.Root

A tag input with chips.

PropTypeDefault
valuestring[]

Controlled tags.

onValueChange(tags: string[]) => void

Called when tags change.

delimitersstring[]

Keys that commit a tag.

[',', 'Enter']
maxTagsnumber

Maximum number of tags.

duplicateTagsboolean

Allow duplicate tags.

false

TagsInput.Input

The text input.

PropTypeDefault

TagsInput.Tag

A single chip.

PropTypeDefault
indexnumber

The tag index.

Tags Input | structyl