React Native MantineInputs

TagsInput

Enter tags with suggestions support

Import: import { TagsInput } from 'react-native-mantine';

Usage

import { TagsInput } from 'react-native-mantine';

const [tags, setTags] = useState<string[]>([]);

<TagsInput
  label="Technologies"
  placeholder="Pick or type technologies"
  data={['React', 'Angular', 'Vue', 'Svelte']}
  value={tags}
  onChange={setTags}
  maxTags={5}
  splitChars={[',', ' ']}
  clearable
  nothingFoundMessage="Nothing found..."
/>

Props

PropTypeDefaultDescription
datastring[][]Suggestions displayed in the dropdown
valuestring[]Controlled value. If provided, component becomes controlled
defaultValuestring[]Default value for uncontrolled component
onChange(value: string[]) => voidCalled when value changes, receives the new tags array
searchValuestringControlled search value
defaultSearchValuestringDefault search value for uncontrolled component
onSearchChange(value: string) => voidCalled when search value changes
maxTagsnumberMaximum number of tags that can be added
allowDuplicatesbooleanfalseDetermines whether duplicate tags are allowed
onDuplicate(value: string) => voidCalled when user tries to submit a duplicated tag
splitCharsstring[][',']Characters that trigger tag split when typed
clearablebooleanfalseDetermines whether the clear button is displayed
onClear() => voidCalled when the clear button is pressed
acceptValueOnBlurbooleantrueIf set, the typed value is accepted when the field loses focus
labelReact.ReactNodeInput label displayed above the input
descriptionReact.ReactNodeInput description displayed below the label
errorReact.ReactNodeError message displayed below the input
placeholderstringField placeholder displayed when the field is empty
size'xs' | 'sm' | 'md' | 'lg' | 'xl'"sm"Controls input height and font size
radiusnumber | "xs" | "sm" | "md" | "lg" | "xl""sm"Key of theme.radius or any valid value to set border-radius
variant'default' | 'filled' | 'unstyled'"default"Input variant
requiredbooleanDisplays required asterisk next to the label
disabledbooleanIf set, input is disabled
maxDropdownHeightnumber200Maximum height of the suggestions list
nothingFoundMessageReact.ReactNodeMessage displayed when no suggestions match the search
styleViewStyleAdditional styles to apply to the root element

Source on GitHub · npm