Vesture

Inputs

TagInputNew in 0.8.0

Chip input with typeahead suggestions, paste-splitting, validation and keyboard editing.

TagInput

Preview

Max tags 6
designreact

2 tags.

Usage

tsx
import { TagInput } from "@vesture/react";

<TagInput
  suggestions={["design", "react", "testing"]}
  maxTags={5}
  validate={(t) => (t.length < 2 ? "Too short" : null)}
  onChange={setTags}
/>

Behavior

  • Enter and comma commit the typed text by default (delimiters). Backspace in an empty field removes the last tag. Pasting a list splits it into tags.
  • validate returns an error message to reject a tag; the message is announced under the field and passed to onReject.

Props

PropTypeDefaultDescription
value / defaultValue / onChangestring[]—Controlled or uncontrolled tags.
suggestions / allowCustomstring[] / boolean[] / trueTypeahead list; set allowCustom false to restrict to it.
allowDuplicates / maxTagsboolean / numberfalseLimits.
delimitersstring[]["Enter", ","]Keys that commit text ("Tab", " " also work).
validate / normalize / onRejectfunction—Validation pipeline.
renderTag(tag, index) => ReactNode—Custom tag content.
invalid / disabled / placeholderboolean / string—State.