TagInput

Text input that converts entered values into removable tag chips. Press Enter to add, Backspace to remove.

Controlled

reacttypescript
import { useState } from 'react'
import { TagInput } from '@canarist/ui'

function Example() {
  const [tags, setTags] = useState(['react', 'typescript'])
  return (
    <TagInput
      label="Keywords"
      value={tags}
      onChange={setTags}
      placeholder="Add tag and press Enter"
    />
  )
}

Reference

PropTypeDefaultDescription
valuestring[]Array of current tags.
onChange(tags: string[]) => voidCalled with the updated tag array.
labelstringLabel shown above the input.
placeholderstringPlaceholder text when no tags are present.
errorstringError message shown below the input.
classNamestringAdditional CSS classes.