Tags Input

React tags input that adds a chip on Enter or comma, skips duplicates, removes the last tag on Backspace and gives each chip a labelled remove button.

src/registry/ui/tags-input.tsx/r/tags-input.json

Installation#

bash
npx shadcn@latest add @minidev/tags-input

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/tags-input.json

Usage#

tsx
import { TagsInput } from "@/components/ui/tags-input"

export function Example() {
  return (
    <TagsInput defaultValue={["react","tailwind"]} aria-label="Tags" />
  )
}

API reference#

TagsInput props
PropTypeDefault
valuestring[]-
defaultValuestring[][]
onChange(tags: string[]) => void-
placeholderstring"Add tag"
disabledboolean-
classNamestring-
aria-labelstring-
aria-invalidboolean-

Dependencies#

npm

lucide-react

Built from

No other MiniDev files

Examples#

All form components

Learn more