Skip to content

TextArrayInput

Lets users enter multiple free-text values (like tags or email addresses) displayed as removable badges.

TextArrayInput

This input allows editing values that are arrays of strings, e.g. ["tag1", "tag2"].

import { TextArrayInput } from '@/components/admin';
<TextArrayInput source="tags" />

Users type text and press Enter to add items. Items appear as removable badges. Press Backspace when the input is empty to remove the last item.

Tip: If you need to let users choose values from a predefined list instead, use <AutocompleteArrayInput>.

PropRequiredTypeDefaultDescription
sourceRequiredstring-Field name
classNameOptionalstring-CSS classes
defaultValueOptionalstring[]-Default value
disabledOptionalboolean-Disable the input
formatOptionalfunction-Callback to convert API value to form value
helperTextOptionalReactNode-Help text displayed below the input
labelOptionalstring | falseInferred from sourceCustom label, or false to hide it
parseOptionalfunction-Callback to convert form value to API value
placeholderOptionalstring-Input placeholder (shown when no values exist)
readOnlyOptionalboolean-Make the input read-only
validateOptionalValidator | Validator[]-Validation rules
KeyAction
EnterAdd the typed text as a new value
BackspaceRemove the last value (when input is empty)
EscapeBlur the input
<TextArrayInput
source="tags"
format={v => v?.map(tag => tag.toLowerCase())}
parse={v => v?.map(tag => tag.trim().toLowerCase())}
/>