"use client";
import { TagInput } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
onValueChange | (value: string[]) => void | — | Called with the next list of tags. |
value | readonly string[] | — | The tags (controlled). |
allowDuplicates | boolean | false | Allow the same tag twice (default false). |
defaultInputValue | string | — | Initial draft text when uncontrolled. |
defaultValue | readonly string[] | — | Initial tags when uncontrolled. |
inputLabel | string | "Tag"; a FormField label wins | Accessible name of the text input (default "Tag"; a FormField label wins). |
inputValue | string | — | Draft text in the input (controlled). |
maxTags | number | — | Hides the input once this many tags exist. |
onAddTag | (tag: string) => void | — | Called after a tag is added (Enter or blur). |
onInputValueChange | (value: string) => void | — | Called with the draft text as it is typed. |
onValueChange(value: string[]) => void
Called with the next list of tags.
valuereadonly string[]
The tags (controlled).
allowDuplicatesdefault falseboolean
Allow the same tag twice (default false).
defaultInputValuestring
Initial draft text when uncontrolled.
defaultValuereadonly string[]
Initial tags when uncontrolled.
inputLabeldefault "Tag"; a FormField label winsstring
Accessible name of the text input (default "Tag"; a FormField label wins).
inputValuestring
Draft text in the input (controlled).
maxTagsnumber
Hides the input once this many tags exist.
onAddTag(tag: string) => void
Called after a tag is added (Enter or blur).
onInputValueChange(value: string) => void
Called with the draft text as it is typed.
Other props are passed to the root element (HTMLAttributes<HTMLDivElement>), including className, style, id and aria-* attributes.
const [tags, setTags] = useState<string[]>(["design"]);
<TagInput value={tags} onValueChange={setTags} />