Tags Input API
View componentThe full prop reference for the Tags Input component. An input that collects a list of tags as chips.
Import
import { TagsInput } from '@structyl/styled';Props
Root
Container for tags and input. Manages tag state and context.
| Prop | Type | Default |
|---|---|---|
| value# | string[]Controlled array of tag strings | — |
| defaultValue# | string[]Initial tags when uncontrolled | [] |
| onValueChange# | (tags: string[]) => voidCallback fired when tags array changes | — |
| delimiters# | string[]Keyboard keys that trigger tag addition | [',', 'Enter'] |
| maxTags# | numberMaximum number of tags allowed; prevents adding beyond this | — |
| duplicateTags# | booleanWhether duplicate tag values are allowed | false |
| disabled# | booleanDisables the input and tag operations | — |
| asChild# | booleanRender as child element (Radix/Headless pattern) | — |
| className# | stringCSS class name; styled version applies default border/flex styles | — |
Input
Text input field for typing and adding tags. Handles delimiter keys and paste.
| Prop | Type | Default |
|---|---|---|
| className# | stringCSS class name; styled version applies flex/outline styles | — |
| placeholder# | stringInput placeholder text (native HTML) | — |
| onChange# | (event: React.ChangeEvent<HTMLInputElement>) => voidComposed with internal value setter; fires on input change | — |
| onKeyDown# | (event: React.KeyboardEvent<HTMLInputElement>) => voidComposed with delimiter logic and backspace handling | — |
| onPaste# | (event: React.ClipboardEvent<HTMLInputElement>) => voidComposed with paste-split logic; splits pasted text by delimiters | — |
Tag
Renders a single tag. Displays tag text with remove button.
| Prop | Type | Default |
|---|---|---|
| index# | numberRequired; position of tag in the array | — |
| tag# | stringTag text; used by styled version to display and label remove button | — |
| children# | React.ReactNodeCustom content to render instead of default tag + remove button | — |
| className# | stringCSS class name; styled version applies badge/pill styles | — |
Items
Maps over all tags and renders each via a render function.
| Prop | Type | Default |
|---|---|---|
| children# | (tag: string, index: number) => React.ReactNodeRequired; called for each tag, receives tag string and index | — |
Source code
If you didn't find what you need here, read the component implementation .