ComponentsForm
Tag Input
A multi-value tag input with removable chips and keyboard support.
Default
With Default Tags
ReactTypeScriptCSS
With Max Limit
ReactVue
Disabled
ReactTypeScript
Installation
npx visor add tag-inputThis copies two files into your project:
components/ui/tag-input/tag-input.tsx— the componentcomponents/ui/tag-input/tag-input.module.css— the styles
Usage
import { TagInput } from '@/components/ui/tag-input/tag-input';
<TagInput placeholder="Add skills..." onChange={(tags) => console.log(tags)} />API Reference
TagInputProps
| Prop | Type | Default | Description |
|---|---|---|---|
value | string[] | — | Controlled array of tag strings. |
defaultValue | string[] | — | Default tags for uncontrolled usage. |
onChange | (tags: string[]) => void | — | Callback when the tag list changes. |
placeholder | string | 'Add tag...' | Placeholder text when no tags are entered. |
max | number | — | Maximum number of tags allowed. |
disabled | boolean | false | Disables the tag input. |
Accessibility
- The input has
role="combobox"witharia-expandedwhen suggestions are shown - Each tag chip has an associated remove button with
aria-label="Remove [tag name]" - Keyboard: Enter or comma adds a tag; Backspace removes the last tag when input is empty; Delete removes a focused tag
- Use an
aria-labelor associated<Label>to describe what kind of tags are expected (e.g., "Skills", "Topics") - When
maxis reached, the input is disabled and anaria-liveregion announces that the limit has been hit