Pro unlocks unlimited templates48:00:00Get Pro →

Tags Input

Type to create chips, or pick from suggestions. Use mode="mention" for teammates with avatars. Multi Select is pick-only from a trigger; Combobox multiple is fixed items — Tags Input is for create-as-you-type.

Gallery

Post tags card with a live count. Type and press Enter or , to create chips.

Loading…

Installation

CLI
npx @sonojs/ui@latest add tags-input
Also needs
npx @sonojs/ui@latest add avatar badge command popover
npm i lucide-react

Usage

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

export function Example() {
  return (
    <TagsInput
      defaultValue={["design", "rtl"]}
      placeholder="Add a tag…"
    />
  )
}

Props

PropTypeDefaultDescription
valuestring[]-Controlled chip values.
defaultValuestring[][]Initial chips when uncontrolled.
onValueChange(value: string[]) => void-Fires when chips change.
optionsTagsInputOption[][]`{ value, label, disabled?, avatar?, description? }` suggestions.
mode"tags" · "mention""tags"`mention` shows people rows and `@` chip labels.
triggerstring"@"Mention prefix stripped when matching typed text.
creatablebooleantrue in tags / false in mentionAllow creating a chip from typed text.
delimitersstring[]["Enter", ","]`Enter` commits on keydown; other single chars split on type/paste.
maxnumber-Maximum number of chips.
allowDuplicatesbooleanfalseAllow the same value more than once.
validate(raw: string) => boolean-Return `false` to reject a creatable commit.
placeholderstring"Add a tag…"Shown when there are no chips.
emptyTextstring"No results found."Empty state in the suggestions list.
disabledbooleanfalseDisables the field and chip remove actions.
classNamestring-Merge Tailwind classes on the field.

Related

  • Multi Select, pick-only chips from a popover list
  • Combobox, fixed-item chips with `multiple`
  • Badge, chip chrome used inside the field