Pathfinderby Commenda
Components

Tag input

Create, edit and remove free-form values using Kakashi’s tag-entry interaction pattern.

Finance
Reviewed
Press Enter or comma to add a label.

Usage

Import TagInput from @commenda/pathfinder/tag-input. Import the compiled stylesheet once. Use Tag input for free-form values; use Multi select when values come from a known set of options.

Examples

Editing and paste

Finance
Operations
Add up to five labels. Double-click a tag to edit it, or paste comma-separated values.

Validation

This example checks email syntax only; the application owns recipient validation.

States

Finance
Archived
This record is archived.
Add a label before continuing.

API reference

PropTypeBehavior
labelConditionalstringRequired accessible field name; alternatively use aria-label
hideLabelbooleanRequired accessible field name; alternatively use aria-label
valueConditionalreadonly string[]Controlled values; callback is required with value
onValueChangeConditional( value: readonly string[] ) => voidControlled values; callback is required with value
defaultValuereadonly string[]Initial uncontrolled values
entryConfigObjectView fieldseditable, addOnPaste, addOnTab, delimiter, maxTags, validate
namestringSubmit each tag as a repeated named value; read with FormData.getAll(name)
formstringSubmit each tag as a repeated named value; read with FormData.getAll(name)
readOnlybooleanValues submit, editing and removal are blocked
disableConfigDisableConfigView fieldsBlocks editing and omits values from form submission
descriptionstringAssociated guidance and validation
errorConfigObjectView fieldsAssociated guidance and validation
requiredConditionalbooleanAssociated guidance and validation
placeholderstringThe ref targets the entry input
onBlurFocusEventHandler<HTMLInputElement>The ref targets the entry input
aria-labelConditionalstringAccessible name when the field has no visible label.
labelConfigObjectView fields · 2 shapesChoose either optionalLabel or help, never both. never excludes the other field.
idstringStable HTML identifier for the component.
classNamestringAdditional classes for the component root.
entryConfigObject fields
FieldTypeRequirement
editablebooleanOptional
addOnPastebooleanOptional
addOnTabbooleanOptional
delimiterstringOptional
maxTagsnumberOptional
validate((tag: string) => string | undefined)Optional

Return a message to reject a tag; undefined accepts it.

disableConfigObject fields
FieldTypeRequirement
isDisabledbooleanRequired
reasonstringOptional
errorConfigObject fields
FieldTypeRequirement
messagestringRequired
reveal"after-blur" | "immediate"Optional
labelConfigObject fields

Choose one of these 2 shapes. Do not combine fields excluded by the selected shape.

Option 1

FieldTypeRequirement
optionalLabelstringRequired

Do not supply: help.

Option 2

FieldTypeRequirement
helpstringRequired

Do not supply: optionalLabel.

Keyboard and validation

Enter or the configured delimiter adds a trimmed tag. Duplicates are rejected. Arrow keys navigate tags, Backspace removes a highlighted tag, and editable tags support keyboard editing. Tab retains normal focus navigation unless addOnTab is enabled. Composition input does not create a tag until composition is complete.

Provide unique, nonempty initial values. Validation belongs to the application; the component never treats an email-shaped value as proof of an address or identity. Uncontrolled native resets restore defaults. Controlled resets remain application-owned.

Design rules

  • TAG-INPUT-001: Reuse the Dice UI primitive used by Kakashi TagInput; ship Pathfinder’s compiled styling without a runtime Kakashi dependency.
  • TAG-INPUT-002: Use the existing field shell and Tag geometry. Wrap long tags without pushing the entry field outside its container.
  • TAG-INPUT-003: Announce invalid entries and retain keyboard focus during editing and removal.
  • TAG-INPUT-004: Read-only and disabled modes prevent mutations; only enabled values participate in form submission.

Tag input is a Kakashi-derived composition of Input and Tag, not a newly extracted standalone Figma component.

On this page