Tag Input

Chip field where Enter, comma or Tab adds a tag that springs in while the rest glide aside via shared layout, with Backspace-twice removal, arrow-key chip navigation, a filtered keyboard-navigable suggestion combobox, max tags, duplicate prevention and a shake on validation rejection; controlled/uncontrolled, reduced-motion safe.

Preview

Tag Input preview width

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @karaui/tag-input
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

value?
string[]

Controlled tags.

—
defaultValue?
string[]

Uncontrolled initial tags.

—
onChange?
((tags: string[]) => void)
—
suggestions?
string[]

Optional suggestion pool, filtered by the typed text. Turns the input into a combobox.

—
maxSuggestions?
number

Most suggestions shown at once. Default 6.

6
maxTags?
number

Refuse new tags once this many exist.

—
validate?
((tag: string, tags: string[]) => string | boolean)

Return `false` to reject a tag, or a string to reject it with that message. Rejection shakes the field.

—
allowDuplicates?
boolean

Allow the same tag twice (case-insensitive). Default false.

false
placeholder?
string
Add a tag…
label?
string
—
hint?
string

Helper text under the field while there is no error.

—
disabled?
boolean
false
aria-label?
string
—
className?
string
—

Updated