Skip to content

TagInput

Used to enter multiple values as tags.

import { useState } from 'react';
import { TagInput } from '@fintech-sandpit/ui/react';
const [value, setValue] = useState<string[]>([]);
return (
<TagInput
value={value}
label="Enter tags"
placeholder="Add tag"
onChange={setValue}
/>
);
NameTypeDefaultDescription
valuestring[]The value of the tag input
defaultValuestring[]The default value of the tag input
namestringThe name of the tag input
sizeSizemdThe size of the tag input
maxLengthnumberThe maximum length of the tag input
blurBehaviorBlurBehaviorblurThe blur behavior of the tag input
placeholderstringPlaceholder of the tag input
requiredbooleanfalseWhether the tag input is required
invalidbooleanfalseWhether the tag input is invalid
read-onlybooleanfalseWhether the tag input is read only
disabledbooleanfalseWhether the tag input is disabled
validate(args: TagInputValidateArgs) => booleanThe validation function of the tag input
NameArgumentsDescription
onChange(value: string[]) => voidCallback fired when the value changes
type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl'
type TagInputValidateArgs = {
value: string[];
inputValue: string;
}

The behavior of the tags input when the input is blurred.

type BlurBehavior = 'add' | 'clear'
ValueDescription
addAdd the input value as a new tag
clearClear the input value