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
Also needs
npx @sonojs/ui@latest add avatar badge command popovernpm i lucide-reactUsage
tags-input.tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string[] | - | Controlled chip values. |
| defaultValue | string[] | [] | Initial chips when uncontrolled. |
| onValueChange | (value: string[]) => void | - | Fires when chips change. |
| options | TagsInputOption[] | [] | `{ value, label, disabled?, avatar?, description? }` suggestions. |
| mode | "tags" · "mention" | "tags" | `mention` shows people rows and `@` chip labels. |
| trigger | string | "@" | Mention prefix stripped when matching typed text. |
| creatable | boolean | true in tags / false in mention | Allow creating a chip from typed text. |
| delimiters | string[] | ["Enter", ","] | `Enter` commits on keydown; other single chars split on type/paste. |
| max | number | - | Maximum number of chips. |
| allowDuplicates | boolean | false | Allow the same value more than once. |
| validate | (raw: string) => boolean | - | Return `false` to reject a creatable commit. |
| placeholder | string | "Add a tag…" | Shown when there are no chips. |
| emptyText | string | "No results found." | Empty state in the suggestions list. |
| disabled | boolean | false | Disables the field and chip remove actions. |
| className | string | - | 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