Skip to content
Forms

Tags Input

Type and commit free-form tags as removable chips.

Import

tsx
import { TagsInput } from "@cooud-ui/ui";
bash
npx cooud-ui add tags-input

Examples

API Reference

Generated from the component's exported types.

TagsInputProps

PropTypeDefaultDescription
value
string[]Controlled list of committed tags. Pair with `onValueChange`.
defaultValue
string[]Initial tags for uncontrolled usage.
onValueChange
(tags: string[]) => voidCalled with the next list of tags whenever a tag is added or removed.
placeholder
stringPlaceholder shown in the text field when it is empty.
max
numberMaximum number of tags. Once reached, further additions are ignored.
disabled
booleanfalseDisables typing and tag removal.
allowDuplicates
booleanfalseWhen true, the same tag may be added more than once. Defaults to false.
delimiter
string | string[]DEFAULT_DELIMITERSCharacters that commit the current input as a tag, in addition to Enter. Defaults to a comma, so both Enter and "," commit.
validate
(tag: string) => booleanReject a tag when this returns false. Receives the trimmed candidate.
aria-invalid
boolean | "true" | "false"Marks the field as invalid, applying error styling.
id
stringNative id for the text input (for an external `<label htmlFor>`).
aria-label
stringAccessible name for the text input when there is no visible label.
aria-labelledby
stringid of an element that labels the text input.
name
stringNative name for the text input.
className
stringExtra classes for the field wrapper.
inputClassName
stringExtra classes for the inner text input.