structyl

Tags Input API

View component

The full prop reference for the Tags Input component. An input that collects a list of tags as chips.

Import

tsx
import { TagsInput } from '@structyl/styled';

Props

Root

Container for tags and input. Manages tag state and context.

PropTypeDefault
value#string[]

Controlled array of tag strings

defaultValue#string[]

Initial tags when uncontrolled

[]
onValueChange#(tags: string[]) => void

Callback fired when tags array changes

delimiters#string[]

Keyboard keys that trigger tag addition

[',', 'Enter']
maxTags#number

Maximum number of tags allowed; prevents adding beyond this

duplicateTags#boolean

Whether duplicate tag values are allowed

false
disabled#boolean

Disables the input and tag operations

asChild#boolean

Render as child element (Radix/Headless pattern)

className#string

CSS class name; styled version applies default border/flex styles

Input

Text input field for typing and adding tags. Handles delimiter keys and paste.

PropTypeDefault
className#string

CSS class name; styled version applies flex/outline styles

placeholder#string

Input placeholder text (native HTML)

onChange#(event: React.ChangeEvent<HTMLInputElement>) => void

Composed with internal value setter; fires on input change

onKeyDown#(event: React.KeyboardEvent<HTMLInputElement>) => void

Composed with delimiter logic and backspace handling

onPaste#(event: React.ClipboardEvent<HTMLInputElement>) => void

Composed with paste-split logic; splits pasted text by delimiters

Tag

Renders a single tag. Displays tag text with remove button.

PropTypeDefault
index#number

Required; position of tag in the array

tag#string

Tag text; used by styled version to display and label remove button

children#React.ReactNode

Custom content to render instead of default tag + remove button

className#string

CSS class name; styled version applies badge/pill styles

Items

Maps over all tags and renders each via a render function.

PropTypeDefault
children#(tag: string, index: number) => React.ReactNode

Required; called for each tag, receives tag string and index

Source code

If you didn't find what you need here, read the component implementation .

structyl — Accessible React Component Library