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[]) => void—Called with the updated tag array.
labelstring—Label shown above the input.
placeholderstring—Placeholder text when no tags are present.
errorstring—Error message shown below the input.
classNamestring—Additional CSS classes.