sheengemologic ui
All components

TagInput

An ordered free-form tag editor with native multi-value submission and stale-safe async validation.@gemologic/sheen · forms

Playground

  • frontend
  • urgent
Press Delete to remove. Hold Alt and press an arrow key, Home, or End to reorder.Press Enter to add a label.
<TagInput label="Labels" name="labels" defaultValue={["frontend", "urgent"]} description="Press Enter to add a label." />

Variant matrix

Project labels
  • frontend
  • urgent
Press Delete to remove. Hold Alt and press an arrow key, Home, or End to reorder.Press Enter to add a label.

Anatomy

Package
@gemologic/sheen
Source
packages/ui/src/primitives/TagInput.tsx
Tokens
  • --sheen-color-bg
  • --sheen-color-border-control
  • --sheen-color-neutral-subtle
  • --sheen-color-focus-ring

Accessibility

Role: labeled text input and native multi-select projectionKeyboard: Enter, Comma, Backspace, Delete, Alt+Arrow keys, Alt+Home, Alt+End

Do

  • Use stable exact strings when order and free-form entry both matter.

Do not

  • Do not use TagInput for selection from a controlled taxonomy; use MultiCombobox.

Generated props

NameTypeDefaultDescription
refHTMLDivElement | ((element: HTMLDivElement) => void)Native root reference.
inputRefHTMLInputElement | ((element: HTMLInputElement) => void)Native editable-input reference.
label *stringRequired visible field label.
namestringNative multi-value form name.
formstringOptional external form ID.
valuereadonly string[]Controlled ordered unique nonempty tag values.
defaultValuereadonly string[]Initial uncontrolled values restored on uncanceled form reset.
onValueChange(value: readonly string[]) => voidReceives ordered committed tag values.
validate(candidate: string, context: TagInputValidationContext, signal: AbortSignal) => TagInputValidationResult | Promise<TagInputValidationResult>Optional sync or async candidate validator. It receives accepted values and an AbortSignal; stale completions cannot publish.
onValidationError(error: unknown) => voidReceives unexpected validator failures after the retained draft receives a localized error.
normalize(draft: string) => stringSynchronous candidate normalization before uniqueness and validation; defaults to trim.
placeholderstringEditable-input placeholder shown only when no tags exist.
descriptionstringSupporting text associated with the editor.
errorstringApp-owned field error, distinct from candidate validation.
disabledbooleanfalseDisables editing, removal, reordering, validation, and form submission.
readOnlybooleanfalseKeeps values and controls inspectable while rejecting changes.
requiredbooleanfalseRequires at least one committed tag in the native form projection.
commitKeysreadonly string[]Keys that validate and commit the current draft; defaults to Enter and comma.
Native Solid/HTML attributes remain available and are omitted from this authored-prop view.