A versatile chip-style input with paste-splitting, dedupe, validation, max-tags, and full keyboard editing — the tags input shadcn doesn't ship.
bunx --bun shadcn@latest add https://ui.ahmet.studio/r/tags-input
import { TagsInput } from "@/components/ui/tags-input"; export function Demo() { const [tags, setTags] = React.useState<string[]>([]); return ( <TagsInput value={tags} onChange={setTags} placeholder="Add a tag..." maxTags={10} formatTag={(t) => t.toLowerCase().replace(/\s+/g, "-")} validate={(t) => /^[a-z0-9-]+$/i.test(t) || "Letters, numbers and dashes only" } /> ); }
react, vue; svelte adds three tags at once.false or a string error from validate.delimiters.sm, default, lg.value / onChange.| Prop | Type | Default |
|---|---|---|
value | string[] | Required |
onChange | (value: string[]) => void | Required |
placeholder | string | "Add tag..." |
delimiters | string[] | ["Enter", ","] |
maxTags | number | undefined |
validate | (tag: string) => boolean | string | undefined |
duplicates | "ignore" | "allow" | "ignore" |
formatTag | (raw: string) => string | undefined |
clearable | boolean | true |
pasteSplit | RegExp | /[\n,;]+/ |
size | "sm" | "default" | "lg" | "default" |
Enter / , / Tab — commit the current draft as a tagBackspace (empty input) — focus the last chip; press again to removeEsc — clear focused chip