JB logo

Command Palette

Search for a command to run...

yOUTUBE
Blog
PreviousNext

Tag Input

Dynamic tag/chip input with validation, max limits, and comma-separated output.

Installation

pnpm dlx shadcn@latest add https://jb.desishub.com/r/tag-input.json

Usage

import { TagInput } from "@/components/tag-input";
<TagInput
  initialValue="react, nextjs, typescript"
  onChange={(tags) => console.log(tags)}
  maxTags={5}
  maxTagLength={20}
/>

Props

PropTypeDefaultDescription
initialValuestring""Initial tags as comma-separated.
onChange(value: string) => void-Called with updated tag string.
placeholderstring"Add tags..."Input placeholder.
maxTagsnumber-Maximum number of tags.
maxTagLengthnumber-Max characters per tag.
disabledbooleanfalseDisable the input.