Getting Started
Installation
Inside your project directory, run the following command:
pnpm add multicompleteBrief introduction
useMultiComplete is a react hook to create a multi-select autocomplete component.
To create your own component, it delivers properties for the 5 basic building blocks of a multi-select autocomplete component:
Schematic overview of the main components of a multi select autocomplete
To get a basic setup, you feed the useMultiComplete hook with:
MyOwnMulticomplete.tsx
import { useMultiComplete } from 'multicomplete'
import { useMemo, useState } from 'react'
 
// component definition ...
 
const options = useMemo(() => ['Option 1', 'Option 2', 'Option 3'])
const [values, setValues] = useState([])
const [isOpen, setIsOpen] = useState(false)
 
const handlers = useMultiComplete({
  options,                    // 1
  values,                     // ┬─ 2
  onChange: setValues,        // ┘
  id: 'my-own-multicomplete', // 3
  isOpen,                     // ┬─ 4
  onOpenChange: setIsOpen,    // ┘
})
 
// rest of component ...- a list of 
options - a 
valuearray and aonChangefunction to update the value - a html 
idto compute all accessibility attributes - (optional) 
isOpenandonOpenChangeto control the visibility of the dropdown